-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathStorageAdapter.ts
More file actions
38 lines (37 loc) · 818 Bytes
/
Copy pathStorageAdapter.ts
File metadata and controls
38 lines (37 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
export type Note = {
id: string;
message: string;
timestamp: number;
};
export type AppendNote = {
/**
* Allow to generate the id in storage internal
*/
id?: string;
message: string;
timestamp: number;
};
/**
* Storage Adapter should implement these methods
*/
export type StorageAdapter = {
/**
* Return an array of Note
* @param listId
*/
getNotes(listId: string): Promise<Note[]>;
/**
* Add the note to the list
* Return the added note
* @param listId
* @param note
*/
appendNote(listId: string, note: AppendNote): Promise<Note>;
/**
* Remove the note from the list
* Return the deleted note
* @param listId
* @param id
*/
deleteNote(listId: string, id: Note["id"]): Promise<Note>;
};