mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
Semi-implemented getting spaces feature
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import 'package:syncrow_app/features/auth/model/token.dart';
|
||||
|
||||
class UserModel {
|
||||
final String? id;
|
||||
final String? uuid;
|
||||
final String? email;
|
||||
final String? name;
|
||||
final String? photoUrl;
|
||||
@ -12,18 +12,8 @@ class UserModel {
|
||||
|
||||
final bool? isAgreementAccepted;
|
||||
|
||||
//token decoded with jwt
|
||||
//{
|
||||
// "email": "Test@Test.com",
|
||||
// "userId": 2,
|
||||
// "uuid": "e145438c-4c62-4535-a0f4-f77958f9f9f4",
|
||||
// "sessionId": "0409a7a1-6ef5-42c5-b3a1-1f15c639b301",
|
||||
// "iat": 1709711675,
|
||||
// "exp": 1709711975
|
||||
// }
|
||||
|
||||
UserModel({
|
||||
required this.id,
|
||||
required this.uuid,
|
||||
required this.email,
|
||||
required this.name,
|
||||
required this.photoUrl,
|
||||
@ -34,7 +24,7 @@ class UserModel {
|
||||
|
||||
factory UserModel.fromJson(Map<String, dynamic> json) {
|
||||
return UserModel(
|
||||
id: json['id'],
|
||||
uuid: json['id'],
|
||||
email: json['email'],
|
||||
name: json['name'],
|
||||
photoUrl: json['photoUrl'],
|
||||
@ -44,12 +34,18 @@ class UserModel {
|
||||
);
|
||||
}
|
||||
|
||||
//uuid to json
|
||||
|
||||
Map<String, dynamic> uuIdAsJson() => {
|
||||
'userUuid': uuid,
|
||||
};
|
||||
|
||||
//from token
|
||||
factory UserModel.fromToken(Token token) {
|
||||
Map<String, dynamic> tempJson = token.decodeToken();
|
||||
|
||||
return UserModel(
|
||||
id: tempJson['uuid'].toString(),
|
||||
uuid: tempJson['uuid'].toString(),
|
||||
email: tempJson['email'],
|
||||
name: null,
|
||||
photoUrl: null,
|
||||
@ -61,7 +57,7 @@ class UserModel {
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'id': uuid,
|
||||
'email': email,
|
||||
'name': name,
|
||||
'photoUrl': photoUrl,
|
||||
|
Reference in New Issue
Block a user