feat: import data from json (#53)

This commit is contained in:
STEVEN
2022-05-15 22:21:13 +08:00
committed by GitHub
parent af4b61143f
commit 615cec3066
12 changed files with 90 additions and 61 deletions

View File

@ -123,13 +123,13 @@ class MemoService {
return memos.filter((m) => m.content.includes(memoId));
}
public async createMemo(text: string): Promise<Model.Memo> {
const memo = await api.createMemo(text);
public async createMemo(content: string): Promise<Model.Memo> {
const memo = await api.createMemo(content);
return this.convertResponseModelMemo(memo);
}
public async updateMemo(memoId: string, text: string): Promise<Model.Memo> {
const memo = await api.updateMemo(memoId, text);
public async updateMemo(memoId: string, content: string): Promise<Model.Memo> {
const memo = await api.updateMemo(memoId, content);
return this.convertResponseModelMemo(memo);
}
@ -141,6 +141,10 @@ class MemoService {
await api.unpinMemo(memoId);
}
public async importMemo(content: string, createdAt: string) {
await api.createMemo(content, createdAt);
}
private convertResponseModelMemo(memo: Model.Memo): Model.Memo {
return {
...memo,