feat: deploy infrastructure + disk/drive, calendar, presentation, workspaces, onboarding, demo user
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
class Workspace {
|
||||
final String id;
|
||||
final String name;
|
||||
final String type;
|
||||
final String? description;
|
||||
final String ownerId;
|
||||
final int memberCount;
|
||||
final DateTime createdAt;
|
||||
|
||||
Workspace({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.type,
|
||||
this.description,
|
||||
required this.ownerId,
|
||||
this.memberCount = 0,
|
||||
required this.createdAt,
|
||||
});
|
||||
|
||||
factory Workspace.fromJson(Map<String, dynamic> json) => Workspace(
|
||||
id: json['id'] as String,
|
||||
name: json['name'] as String,
|
||||
type: json['type'] as String? ?? 'personal',
|
||||
description: json['description'] as String?,
|
||||
ownerId: json['owner_id'] as String? ?? '',
|
||||
memberCount: json['member_count'] as int? ?? 0,
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'type': type,
|
||||
'description': description,
|
||||
'owner_id': ownerId,
|
||||
'member_count': memberCount,
|
||||
'created_at': createdAt.toIso8601String(),
|
||||
};
|
||||
|
||||
bool get isPersonal => type == 'personal';
|
||||
bool get isTeam => type == 'team';
|
||||
}
|
||||
|
||||
class WorkspaceMember {
|
||||
final String id;
|
||||
final String userId;
|
||||
final String userName;
|
||||
final String userEmail;
|
||||
final String role;
|
||||
final DateTime joinedAt;
|
||||
|
||||
WorkspaceMember({
|
||||
required this.id,
|
||||
required this.userId,
|
||||
this.userName = '',
|
||||
this.userEmail = '',
|
||||
required this.role,
|
||||
required this.joinedAt,
|
||||
});
|
||||
|
||||
factory WorkspaceMember.fromJson(Map<String, dynamic> json) =>
|
||||
WorkspaceMember(
|
||||
id: json['id'] as String,
|
||||
userId: json['user_id'] as String? ?? '',
|
||||
userName: json['user_name'] as String? ?? '',
|
||||
userEmail: json['user_email'] as String? ?? '',
|
||||
role: json['role'] as String? ?? 'member',
|
||||
joinedAt: json['created_at'] != null
|
||||
? DateTime.parse(json['created_at'] as String)
|
||||
: DateTime.now(),
|
||||
);
|
||||
}
|
||||
|
||||
class CreateWorkspaceRequest {
|
||||
final String name;
|
||||
final String? description;
|
||||
|
||||
CreateWorkspaceRequest({required this.name, this.description});
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'name': name,
|
||||
'description': description,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user