mm
This commit is contained in:
0
packages/bookmark-sync/package.json
Normal file
0
packages/bookmark-sync/package.json
Normal file
27
packages/bookmark-sync/src/nodes/bookmark-node.ts
Normal file
27
packages/bookmark-sync/src/nodes/bookmark-node.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
export type VersionVector = {
|
||||
deviceId: string; // 一个手机可能会有多个浏览器登录,通常一个浏览器被称为一个设备
|
||||
};
|
||||
|
||||
export interface IBookmarkNode {
|
||||
id: string;
|
||||
title: string;
|
||||
parentId: string | null;
|
||||
|
||||
rename(title: string): void;
|
||||
}
|
||||
|
||||
export class BookmarkNode implements IBookmarkNode {
|
||||
id: string;
|
||||
title: string;
|
||||
parentId: string | null;
|
||||
|
||||
constructor(id: string, title: string) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.parentId = null;
|
||||
}
|
||||
|
||||
rename(title: string) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
39
packages/bookmark-sync/src/nodes/folder-node.ts
Normal file
39
packages/bookmark-sync/src/nodes/folder-node.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { BookmarkNode } from "./bookmark-node";
|
||||
|
||||
export interface IFolderNode {
|
||||
id: string;
|
||||
title: string;
|
||||
parentId: string | null;
|
||||
bookmarkNode: BookmarkNode[];
|
||||
|
||||
addBookmarkNode(node: BookmarkNode): void;
|
||||
rename(title: string): void;
|
||||
}
|
||||
|
||||
export class FolderNode implements IFolderNode {
|
||||
id: string;
|
||||
title: string;
|
||||
parentId: string | null;
|
||||
bookmarkNode: BookmarkNode[];
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
title: string,
|
||||
parentId: string | null = null,
|
||||
bookmarkNode: BookmarkNode[],
|
||||
) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.parentId = parentId;
|
||||
this.bookmarkNode = bookmarkNode;
|
||||
}
|
||||
|
||||
addBookmarkNode(node: BookmarkNode): void {
|
||||
this.bookmarkNode.push(node);
|
||||
node.parentId = this.id;
|
||||
}
|
||||
|
||||
rename(title: string) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
17
packages/bookmark-sync/src/service/Server.ts
Normal file
17
packages/bookmark-sync/src/service/Server.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export class Server {
|
||||
serverUrl: string;
|
||||
|
||||
constructor(serverUrl: string) {
|
||||
this.serverUrl = serverUrl;
|
||||
}
|
||||
|
||||
login(email: string, password: string) {
|
||||
const result = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
logout(email: string, password: string) {
|
||||
const result = false;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user