mirror of https://github.com/fantasticit/think.git
feat: update IDocument
This commit is contained in:
parent
b40edbd04f
commit
666ee01a01
|
@ -1,2 +1,2 @@
|
||||||
export * from "./models";
|
export * from './models';
|
||||||
export * from "./util";
|
export * from './util';
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { IUser } from "./user";
|
import { IUser } from './user';
|
||||||
import { IDocument } from "./document";
|
import { IDocument } from './document';
|
||||||
export interface IComment {
|
export interface IComment {
|
||||||
id: string;
|
id: string;
|
||||||
parentCommentId?: IComment["id"];
|
parentCommentId?: IComment['id'];
|
||||||
documentId: IDocument["id"];
|
documentId: IDocument['id'];
|
||||||
createUserId: IUser["id"];
|
createUserId: IUser['id'];
|
||||||
createUser: IUser;
|
createUser: IUser;
|
||||||
replyUserId?: IUser["id"];
|
replyUserId?: IUser['id'];
|
||||||
replyUser?: IUser;
|
replyUser?: IUser;
|
||||||
html: string;
|
html: string;
|
||||||
userAgent: string;
|
userAgent: string;
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
import { IUser } from "./user";
|
import { IUser } from './user';
|
||||||
import { IWiki } from "./wiki";
|
import { IWiki } from './wiki';
|
||||||
export declare enum DocumentStatus {
|
export declare enum DocumentStatus {
|
||||||
private = "private",
|
private = "private",
|
||||||
public = "public"
|
public = "public"
|
||||||
}
|
}
|
||||||
export interface IDocument {
|
export interface IDocument {
|
||||||
id: string;
|
id: string;
|
||||||
wikiId: IWiki["id"];
|
wikiId: IWiki['id'];
|
||||||
isWikiHome: boolean;
|
isWikiHome: boolean;
|
||||||
createUserId: IUser["id"];
|
createUserId: IUser['id'];
|
||||||
createUser: IUser;
|
createUser: IUser;
|
||||||
parentDocumentId?: IDocument["id"];
|
parentDocumentId?: IDocument['id'];
|
||||||
title: string;
|
title: string;
|
||||||
content: string;
|
content: string;
|
||||||
|
state: Uint8Array;
|
||||||
status: DocumentStatus;
|
status: DocumentStatus;
|
||||||
views: number;
|
views: number;
|
||||||
sharePassword?: string;
|
sharePassword?: string;
|
||||||
|
@ -22,8 +23,8 @@ export interface IDocument {
|
||||||
}
|
}
|
||||||
export interface IAuthority {
|
export interface IAuthority {
|
||||||
id: string;
|
id: string;
|
||||||
documentId: IDocument["id"];
|
documentId: IDocument['id'];
|
||||||
userId: IUser["id"];
|
userId: IUser['id'];
|
||||||
readable: boolean;
|
readable: boolean;
|
||||||
editable: boolean;
|
editable: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
export * from "./user";
|
export * from './user';
|
||||||
export * from "./wiki";
|
export * from './wiki';
|
||||||
export * from "./document";
|
export * from './document';
|
||||||
export * from "./message";
|
export * from './message';
|
||||||
export * from "./template";
|
export * from './template';
|
||||||
export * from "./comment";
|
export * from './comment';
|
||||||
export * from "./collector";
|
export * from './collector';
|
||||||
export * from "./pagination";
|
export * from './pagination';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { IUser } from "./user";
|
import { IUser } from './user';
|
||||||
export interface IMessage {
|
export interface IMessage {
|
||||||
id: string;
|
id: string;
|
||||||
userId: IUser["id"];
|
userId: IUser['id'];
|
||||||
title: string;
|
title: string;
|
||||||
message: string;
|
message: string;
|
||||||
url: string;
|
url: string;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { IUser } from "./user";
|
import { IUser } from './user';
|
||||||
export interface ITemplate {
|
export interface ITemplate {
|
||||||
id: string;
|
id: string;
|
||||||
createUserId: IUser["id"];
|
createUserId: IUser['id'];
|
||||||
createUser: IUser;
|
createUser: IUser;
|
||||||
title: string;
|
title: string;
|
||||||
content: string;
|
content: string;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { IUser } from "./user";
|
import { IUser } from './user';
|
||||||
export declare enum WikiStatus {
|
export declare enum WikiStatus {
|
||||||
private = "private",
|
private = "private",
|
||||||
public = "public"
|
public = "public"
|
||||||
|
@ -17,7 +17,7 @@ export interface IWiki {
|
||||||
name: string;
|
name: string;
|
||||||
avatar: string;
|
avatar: string;
|
||||||
description: string;
|
description: string;
|
||||||
createUserId: IUser["id"];
|
createUserId: IUser['id'];
|
||||||
createUser: IUser;
|
createUser: IUser;
|
||||||
status: WikiStatus;
|
status: WikiStatus;
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { WikiStatus, WikiUserRole, DocumentStatus, IWiki, IDocument } from "./models";
|
import { WikiStatus, WikiUserRole, DocumentStatus, IWiki, IDocument } from './models';
|
||||||
export declare const WIKI_STATUS_LIST: {
|
export declare const WIKI_STATUS_LIST: {
|
||||||
value: WikiStatus;
|
value: WikiStatus;
|
||||||
label: string;
|
label: string;
|
||||||
|
@ -12,6 +12,6 @@ export declare const DOCUMENT_STATUS: {
|
||||||
label: string;
|
label: string;
|
||||||
}[];
|
}[];
|
||||||
export declare const getWikiStatusText: (wiki: IWiki) => string;
|
export declare const getWikiStatusText: (wiki: IWiki) => string;
|
||||||
export declare const isPublicWiki: (currentStatus: IWiki["status"]) => boolean;
|
export declare const isPublicWiki: (currentStatus: IWiki['status']) => boolean;
|
||||||
export declare const getWikiUserRoleText: (role: WikiUserRole) => string;
|
export declare const getWikiUserRoleText: (role: WikiUserRole) => string;
|
||||||
export declare const isPublicDocument: (currentStatus: IDocument["status"]) => boolean;
|
export declare const isPublicDocument: (currentStatus: IDocument['status']) => boolean;
|
||||||
|
|
|
@ -5,31 +5,31 @@ const models_1 = require("./models");
|
||||||
exports.WIKI_STATUS_LIST = [
|
exports.WIKI_STATUS_LIST = [
|
||||||
{
|
{
|
||||||
value: models_1.WikiStatus.private,
|
value: models_1.WikiStatus.private,
|
||||||
label: "私有",
|
label: '私有',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: models_1.WikiStatus.public,
|
value: models_1.WikiStatus.public,
|
||||||
label: "公开",
|
label: '公开',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
exports.WIKI_USER_ROLES = [
|
exports.WIKI_USER_ROLES = [
|
||||||
{
|
{
|
||||||
value: "admin",
|
value: 'admin',
|
||||||
label: "管理员",
|
label: '管理员',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "normal",
|
value: 'normal',
|
||||||
label: "成员",
|
label: '成员',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
exports.DOCUMENT_STATUS = [
|
exports.DOCUMENT_STATUS = [
|
||||||
{
|
{
|
||||||
value: models_1.DocumentStatus.private,
|
value: models_1.DocumentStatus.private,
|
||||||
label: "私有",
|
label: '私有',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: models_1.DocumentStatus.public,
|
value: models_1.DocumentStatus.public,
|
||||||
label: "公开",
|
label: '公开',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const getWikiStatusText = (wiki) => {
|
const getWikiStatusText = (wiki) => {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;AAAA,qCAMkB;AAKL,QAAA,gBAAgB,GAAG;IAC9B;QACE,KAAK,EAAE,mBAAU,CAAC,OAAO;QACzB,KAAK,EAAE,IAAI;KACZ;IACD;QACE,KAAK,EAAE,mBAAU,CAAC,MAAM;QACxB,KAAK,EAAE,IAAI;KACZ;CACF,CAAC;AAKW,QAAA,eAAe,GAAG;IAC7B;QACE,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,KAAK;KACb;IACD;QACE,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,IAAI;KACZ;CACF,CAAC;AAKW,QAAA,eAAe,GAAG;IAC7B;QACE,KAAK,EAAE,uBAAc,CAAC,OAAO;QAC7B,KAAK,EAAE,IAAI;KACZ;IACD;QACE,KAAK,EAAE,uBAAc,CAAC,MAAM;QAC5B,KAAK,EAAE,IAAI;KACZ;CACF,CAAC;AAOK,MAAM,iBAAiB,GAAG,CAAC,IAAW,EAAU,EAAE;IACvD,OAAO,wBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,E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AAE;IACvD,OAAO,wBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC;AACrE,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B;AAOK,MAAM,YAAY,GAAG,CAAC,aAA8B,EAAE,EAAE,CAAC,aAAa,KAAK,mBAAU,CAAC,MAAM,CAAC;AAAvF,QAAA,YAAY,gBAA2E;AAO7F,MAAM,mBAAmB,GAAG,CAAC,IAAkB,EAAE,EAAE;IACxD,OAAO,uBAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC;AAC7D,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAOK,MAAM,gBAAgB,GAAG,CAAC,aAAkC,EAAE,EAAE,CAAC,aAAa,KAAK,uBAAc,CAAC,MAAM,CAAC;AAAnG,QAAA,gBAAgB,oBAAmF"}
|
|
@ -21,6 +21,7 @@ export interface IDocument {
|
||||||
parentDocumentId?: IDocument['id'];
|
parentDocumentId?: IDocument['id'];
|
||||||
title: string;
|
title: string;
|
||||||
content: string;
|
content: string;
|
||||||
|
state: Uint8Array;
|
||||||
status: DocumentStatus;
|
status: DocumentStatus;
|
||||||
views: number;
|
views: number;
|
||||||
sharePassword?: string;
|
sharePassword?: string;
|
||||||
|
|
|
@ -18,38 +18,26 @@ import { CreateDocumentDto } from '@dtos/create-document.dto';
|
||||||
import { UpdateDocumentDto } from '@dtos/update-document.dto';
|
import { UpdateDocumentDto } from '@dtos/update-document.dto';
|
||||||
import { ShareDocumentDto } from '@dtos/share-document.dto';
|
import { ShareDocumentDto } from '@dtos/share-document.dto';
|
||||||
|
|
||||||
const DOCUMENT_PLACEHOLDERS = [
|
const EMPTY_DOCUMNENT = {
|
||||||
{
|
|
||||||
content: JSON.stringify({
|
content: JSON.stringify({
|
||||||
default: {
|
default: {
|
||||||
type: 'doc',
|
type: 'doc',
|
||||||
content: [
|
content: [{ type: 'title', content: [{ type: 'text', text: '未命名文档' }] }],
|
||||||
{ type: 'title', content: [{ type: 'text', text: '未命名文档' }] },
|
|
||||||
{
|
|
||||||
type: 'paragraph',
|
|
||||||
attrs: { textAlign: 'left', indent: 0 },
|
|
||||||
content: [{ type: 'text', text: '在此编辑正文...' }],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
state: Buffer.from(
|
state: Buffer.from(
|
||||||
new Uint8Array([
|
new Uint8Array([
|
||||||
3, 3, 221, 238, 169, 254, 11, 0, 40, 0, 150, 148, 219, 254, 3, 88, 6, 105, 110, 100, 101, 110, 116, 1, 125, 0,
|
1, 14, 204, 224, 154, 225, 13, 0, 7, 1, 7, 100, 101, 102, 97, 117, 108, 116, 3, 5, 116, 105, 116, 108, 101, 1, 0,
|
||||||
7, 0, 215, 168, 212, 201, 8, 1, 6, 4, 0, 221, 238, 169, 254, 11, 1, 15, 230, 156, 170, 229, 145, 189, 229, 144,
|
204, 224, 154, 225, 13, 0, 1, 0, 1, 135, 204, 224, 154, 225, 13, 0, 3, 9, 112, 97, 114, 97, 103, 114, 97, 112,
|
||||||
141, 230, 150, 135, 230, 161, 163, 2, 215, 168, 212, 201, 8, 0, 0, 1, 71, 150, 148, 219, 254, 3, 0, 3, 5, 116,
|
104, 40, 0, 204, 224, 154, 225, 13, 3, 6, 105, 110, 100, 101, 110, 116, 1, 125, 0, 40, 0, 204, 224, 154, 225, 13,
|
||||||
105, 116, 108, 101, 15, 150, 148, 219, 254, 3, 0, 1, 1, 7, 100, 101, 102, 97, 117, 108, 116, 1, 0, 23, 129, 150,
|
3, 9, 116, 101, 120, 116, 65, 108, 105, 103, 110, 1, 119, 4, 108, 101, 102, 116, 0, 4, 71, 204, 224, 154, 225, 13,
|
||||||
148, 219, 254, 3, 0, 1, 0, 63, 199, 150, 148, 219, 254, 3, 0, 150, 148, 219, 254, 3, 24, 3, 9, 112, 97, 114, 97,
|
1, 6, 1, 0, 204, 224, 154, 225, 13, 10, 3, 132, 204, 224, 154, 225, 13, 13, 3, 230, 156, 170, 129, 204, 224, 154,
|
||||||
103, 114, 97, 112, 104, 40, 0, 150, 148, 219, 254, 3, 88, 9, 116, 101, 120, 116, 65, 108, 105, 103, 110, 1, 119,
|
225, 13, 14, 6, 132, 204, 224, 154, 225, 13, 20, 6, 229, 145, 189, 229, 144, 141, 129, 204, 224, 154, 225, 13, 22,
|
||||||
4, 108, 101, 102, 116, 1, 0, 150, 148, 219, 254, 3, 88, 1, 0, 7, 71, 150, 148, 219, 254, 3, 90, 6, 1, 0, 150,
|
5, 132, 204, 224, 154, 225, 13, 27, 6, 230, 150, 135, 230, 161, 163, 1, 204, 224, 154, 225, 13, 5, 1, 2, 6, 4, 11,
|
||||||
148, 219, 254, 3, 98, 6, 132, 150, 148, 219, 254, 3, 104, 6, 229, 156, 168, 230, 173, 164, 129, 150, 148, 219,
|
3, 15, 6, 23, 5,
|
||||||
254, 3, 106, 7, 132, 150, 148, 219, 254, 3, 113, 6, 231, 188, 150, 232, 190, 145, 129, 150, 148, 219, 254, 3,
|
|
||||||
115, 32, 132, 150, 148, 219, 254, 3, 147, 1, 9, 230, 173, 163, 230, 150, 135, 46, 46, 46, 2, 150, 148, 219, 254,
|
|
||||||
3, 5, 0, 88, 90, 8, 99, 6, 107, 7, 116, 32, 215, 168, 212, 201, 8, 1, 0, 1,
|
|
||||||
])
|
])
|
||||||
),
|
),
|
||||||
},
|
};
|
||||||
];
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DocumentService {
|
export class DocumentService {
|
||||||
|
@ -322,9 +310,7 @@ export class DocumentService {
|
||||||
isWikiHome,
|
isWikiHome,
|
||||||
title: '未命名文档',
|
title: '未命名文档',
|
||||||
index: maxIndex + 1,
|
index: maxIndex + 1,
|
||||||
// content: '',
|
...EMPTY_DOCUMNENT,
|
||||||
// state: Buffer.from(new Uint8Array()),
|
|
||||||
...DOCUMENT_PLACEHOLDERS[0],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (dto.templateId) {
|
if (dto.templateId) {
|
||||||
|
|
Loading…
Reference in New Issue