Created
June 3, 2023 18:22
-
-
Save zddarova/70e46b344f5b15bc9a1584325aded1e9 to your computer and use it in GitHub Desktop.
memory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddMemoryRequest { | |
final String title; | |
final String? description; | |
final DateTime date; | |
} | |
class MemoryModel { | |
final String muid; | |
final String title; | |
final String? description; | |
final DateTime date; | |
} | |
/* | |
GET | |
data in queryParams | |
get list of memoty models | |
================================================================ send request | |
{ | |
userId: localUUID | |
} | |
================================================================ get reponse | |
{ | |
status: string | |
data: { | |
uuid: [ | |
{ | |
'muid': String | |
'title': string | |
'description': string | |
'date': date.toIso1867, | |
}, | |
{ | |
'muid': String | |
'title': string | |
'description': string | |
'date': date.toIso1867, | |
}, | |
] | |
} | |
} | |
data in body | |
POST | |
here we use AddMemoryRequest | |
================================================================ send request | |
{ | |
userId: LocalUUID, | |
memory: { | |
'title': string | |
'description': string | |
'date': date.toIso1867; | |
} | |
} | |
================================================================ get reponse | |
{ | |
status: string, | |
data:{ | |
userId: LocalUUID, | |
memory: { | |
'muid': String | |
'title': string | |
'description': string | |
'date': date.toIso1867; | |
} | |
} | |
} | |
PUT | |
================================================================ send request | |
{ | |
userId: LocalUUID, | |
memory: { | |
'muid': String | |
'title': string | |
'description': string | |
'date': date.toIso1867, | |
} | |
} | |
================================================================ get reponse | |
{ | |
status: string, | |
data: { | |
userId: LocalUUID, | |
memory: { | |
'muid': String | |
'title': string | |
'description': string | |
'date': date.toIso1867; | |
} | |
} | |
} | |
DELETE | |
================================================================ send request | |
{ | |
userId: LocalUUID, | |
memoryUUID: muid | |
} | |
================================================================ get reponse | |
{ | |
status: string, | |
data: { | |
userId: LocalUUID, | |
memoryUUID: muid | |
} | |
} | |
*/ | |
final User { | |
final String uuid; // geerates randomly on frontend side | |
} | |
class Repo { | |
String? _uuid; | |
Future<String> get uuid { | |
if(_uuid == null){ _uuid = await generateUUID();} | |
return _uuid; | |
} | |
} | |
class Repo { | |
Future<String>? _uuid; | |
Future<String> get uuid { | |
if(_uuid == null) _uuid = generateUUID; | |
return _uuid; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment