boh
This commit is contained in:
@@ -13,7 +13,10 @@ class StaffRepository {
|
||||
Future<List<StaffMemberModel>> getStaffMembers(String companyId) async {
|
||||
final response = await _supabase
|
||||
.from(Tables.staffMembers)
|
||||
.select()
|
||||
.select('''
|
||||
*,
|
||||
stores (*)
|
||||
''')
|
||||
.eq('company_id', companyId)
|
||||
.order('name', ascending: true);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flux/features/master_data/store/models/store_model.dart';
|
||||
|
||||
// L'Enum magico e blindato per il sistema
|
||||
enum SystemRole {
|
||||
@@ -26,6 +27,7 @@ class StaffMemberModel extends Equatable {
|
||||
final SystemRole systemRole;
|
||||
final bool isActive;
|
||||
final bool hasJoined;
|
||||
final StoreModel? store;
|
||||
|
||||
const StaffMemberModel({
|
||||
this.id,
|
||||
@@ -38,6 +40,7 @@ class StaffMemberModel extends Equatable {
|
||||
this.systemRole = SystemRole.user,
|
||||
this.isActive = true,
|
||||
this.hasJoined = false,
|
||||
this.store,
|
||||
});
|
||||
|
||||
StaffMemberModel copyWith({
|
||||
@@ -52,6 +55,7 @@ class StaffMemberModel extends Equatable {
|
||||
SystemRole? systemRole,
|
||||
bool? isActive,
|
||||
bool? hasJoined,
|
||||
StoreModel? store,
|
||||
}) {
|
||||
return StaffMemberModel(
|
||||
id: id ?? this.id,
|
||||
@@ -64,6 +68,7 @@ class StaffMemberModel extends Equatable {
|
||||
systemRole: systemRole ?? this.systemRole,
|
||||
isActive: isActive ?? this.isActive,
|
||||
hasJoined: hasJoined ?? this.hasJoined,
|
||||
store: store ?? this.store,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -90,6 +95,7 @@ class StaffMemberModel extends Equatable {
|
||||
systemRole: SystemRole.fromString(map['system_role']),
|
||||
isActive: map['is_active'] ?? true,
|
||||
hasJoined: map['has_joined'] ?? false,
|
||||
store: map['store'] != null ? StoreModel.fromMap(map['store']) : null,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -120,5 +126,6 @@ class StaffMemberModel extends Equatable {
|
||||
systemRole,
|
||||
isActive,
|
||||
hasJoined,
|
||||
store,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user