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 "./util";
|
||||
export * from './models';
|
||||
export * from './util';
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { IUser } from "./user";
|
||||
import { IDocument } from "./document";
|
||||
import { IUser } from './user';
|
||||
import { IDocument } from './document';
|
||||
export interface IComment {
|
||||
id: string;
|
||||
parentCommentId?: IComment["id"];
|
||||
documentId: IDocument["id"];
|
||||
createUserId: IUser["id"];
|
||||
parentCommentId?: IComment['id'];
|
||||
documentId: IDocument['id'];
|
||||
createUserId: IUser['id'];
|
||||
createUser: IUser;
|
||||
replyUserId?: IUser["id"];
|
||||
replyUserId?: IUser['id'];
|
||||
replyUser?: IUser;
|
||||
html: string;
|
||||
userAgent: string;
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
import { IUser } from "./user";
|
||||
import { IWiki } from "./wiki";
|
||||
import { IUser } from './user';
|
||||
import { IWiki } from './wiki';
|
||||
export declare enum DocumentStatus {
|
||||
private = "private",
|
||||
public = "public"
|
||||
}
|
||||
export interface IDocument {
|
||||
id: string;
|
||||
wikiId: IWiki["id"];
|
||||
wikiId: IWiki['id'];
|
||||
isWikiHome: boolean;
|
||||
createUserId: IUser["id"];
|
||||
createUserId: IUser['id'];
|
||||
createUser: IUser;
|
||||
parentDocumentId?: IDocument["id"];
|
||||
parentDocumentId?: IDocument['id'];
|
||||
title: string;
|
||||
content: string;
|
||||
state: Uint8Array;
|
||||
status: DocumentStatus;
|
||||
views: number;
|
||||
sharePassword?: string;
|
||||
|
@ -22,8 +23,8 @@ export interface IDocument {
|
|||
}
|
||||
export interface IAuthority {
|
||||
id: string;
|
||||
documentId: IDocument["id"];
|
||||
userId: IUser["id"];
|
||||
documentId: IDocument['id'];
|
||||
userId: IUser['id'];
|
||||
readable: boolean;
|
||||
editable: boolean;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
export * from "./user";
|
||||
export * from "./wiki";
|
||||
export * from "./document";
|
||||
export * from "./message";
|
||||
export * from "./template";
|
||||
export * from "./comment";
|
||||
export * from "./collector";
|
||||
export * from "./pagination";
|
||||
export * from './user';
|
||||
export * from './wiki';
|
||||
export * from './document';
|
||||
export * from './message';
|
||||
export * from './template';
|
||||
export * from './comment';
|
||||
export * from './collector';
|
||||
export * from './pagination';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { IUser } from "./user";
|
||||
import { IUser } from './user';
|
||||
export interface IMessage {
|
||||
id: string;
|
||||
userId: IUser["id"];
|
||||
userId: IUser['id'];
|
||||
title: string;
|
||||
message: string;
|
||||
url: string;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { IUser } from "./user";
|
||||
import { IUser } from './user';
|
||||
export interface ITemplate {
|
||||
id: string;
|
||||
createUserId: IUser["id"];
|
||||
createUserId: IUser['id'];
|
||||
createUser: IUser;
|
||||
title: string;
|
||||
content: string;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { IUser } from "./user";
|
||||
import { IUser } from './user';
|
||||
export declare enum WikiStatus {
|
||||
private = "private",
|
||||
public = "public"
|
||||
|
@ -17,7 +17,7 @@ export interface IWiki {
|
|||
name: string;
|
||||
avatar: string;
|
||||
description: string;
|
||||
createUserId: IUser["id"];
|
||||
createUserId: IUser['id'];
|
||||
createUser: IUser;
|
||||
status: WikiStatus;
|
||||
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: {
|
||||
value: WikiStatus;
|
||||
label: string;
|
||||
|
@ -12,6 +12,6 @@ export declare const DOCUMENT_STATUS: {
|
|||
label: 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 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 = [
|
||||
{
|
||||
value: models_1.WikiStatus.private,
|
||||
label: "私有",
|
||||
label: '私有',
|
||||
},
|
||||
{
|
||||
value: models_1.WikiStatus.public,
|
||||
label: "公开",
|
||||
label: '公开',
|
||||
},
|
||||
];
|
||||
exports.WIKI_USER_ROLES = [
|
||||
{
|
||||
value: "admin",
|
||||
label: "管理员",
|
||||
value: 'admin',
|
||||
label: '管理员',
|
||||
},
|
||||
{
|
||||
value: "normal",
|
||||
label: "成员",
|
||||
value: 'normal',
|
||||
label: '成员',
|
||||
},
|
||||
];
|
||||
exports.DOCUMENT_STATUS = [
|
||||
{
|
||||
value: models_1.DocumentStatus.private,
|
||||
label: "私有",
|
||||
label: '私有',
|
||||
},
|
||||
{
|
||||
value: models_1.DocumentStatus.public,
|
||||
label: "公开",
|
||||
label: '公开',
|
||||
},
|
||||
];
|
||||
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,KA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E,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,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'];
|
||||
title: string;
|
||||
content: string;
|
||||
state: Uint8Array;
|
||||
status: DocumentStatus;
|
||||
views: number;
|
||||
sharePassword?: string;
|
||||
|
|
|
@ -18,38 +18,26 @@ import { CreateDocumentDto } from '@dtos/create-document.dto';
|
|||
import { UpdateDocumentDto } from '@dtos/update-document.dto';
|
||||
import { ShareDocumentDto } from '@dtos/share-document.dto';
|
||||
|
||||
const DOCUMENT_PLACEHOLDERS = [
|
||||
{
|
||||
content: JSON.stringify({
|
||||
default: {
|
||||
type: 'doc',
|
||||
content: [
|
||||
{ type: 'title', content: [{ type: 'text', text: '未命名文档' }] },
|
||||
{
|
||||
type: 'paragraph',
|
||||
attrs: { textAlign: 'left', indent: 0 },
|
||||
content: [{ type: 'text', text: '在此编辑正文...' }],
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
state: Buffer.from(
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
148, 219, 254, 3, 98, 6, 132, 150, 148, 219, 254, 3, 104, 6, 229, 156, 168, 230, 173, 164, 129, 150, 148, 219,
|
||||
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,
|
||||
])
|
||||
),
|
||||
},
|
||||
];
|
||||
const EMPTY_DOCUMNENT = {
|
||||
content: JSON.stringify({
|
||||
default: {
|
||||
type: 'doc',
|
||||
content: [{ type: 'title', content: [{ type: 'text', text: '未命名文档' }] }],
|
||||
},
|
||||
}),
|
||||
state: Buffer.from(
|
||||
new Uint8Array([
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
3, 15, 6, 23, 5,
|
||||
])
|
||||
),
|
||||
};
|
||||
|
||||
@Injectable()
|
||||
export class DocumentService {
|
||||
|
@ -322,9 +310,7 @@ export class DocumentService {
|
|||
isWikiHome,
|
||||
title: '未命名文档',
|
||||
index: maxIndex + 1,
|
||||
// content: '',
|
||||
// state: Buffer.from(new Uint8Array()),
|
||||
...DOCUMENT_PLACEHOLDERS[0],
|
||||
...EMPTY_DOCUMNENT,
|
||||
};
|
||||
|
||||
if (dto.templateId) {
|
||||
|
|
Loading…
Reference in New Issue