92 lines
2.1 KiB
Dart
92 lines
2.1 KiB
Dart
import 'package:drift/drift.dart' hide JsonKey;
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
import 'package:niogu_app/core/database/app_database.dart';
|
|
import 'package:niogu_app/core/enums/sync_status.dart';
|
|
|
|
part 'staff_model.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class StaffModel {
|
|
@JsonKey(name: 'id')
|
|
final String serverId;
|
|
|
|
@JsonKey(name: 'outlet_id')
|
|
final String outletId;
|
|
|
|
final String name;
|
|
|
|
final String? email;
|
|
|
|
@JsonKey(name: 'phone_number')
|
|
final String? phoneNumber;
|
|
|
|
final String role;
|
|
|
|
@JsonKey(name: 'place_of_birth')
|
|
final String? placeOfBirth;
|
|
|
|
@JsonKey(name: 'date_of_birth')
|
|
final String? dateOfBirth;
|
|
|
|
@JsonKey(name: 'shift_name')
|
|
final String? shiftName;
|
|
|
|
@JsonKey(name: 'shift_start_time')
|
|
final String? shiftStartTime;
|
|
|
|
@JsonKey(name: 'shift_end_time')
|
|
final String? shiftEndTime;
|
|
|
|
@JsonKey(name: 'is_active')
|
|
final bool isActive;
|
|
|
|
@JsonKey(name: 'created_at')
|
|
final DateTime createdAt;
|
|
|
|
@JsonKey(name: 'updated_at')
|
|
final DateTime updatedAt;
|
|
|
|
const StaffModel({
|
|
required this.serverId,
|
|
required this.outletId,
|
|
required this.name,
|
|
this.email,
|
|
this.phoneNumber,
|
|
required this.role,
|
|
this.placeOfBirth,
|
|
this.dateOfBirth,
|
|
this.shiftName,
|
|
this.shiftStartTime,
|
|
this.shiftEndTime,
|
|
required this.isActive,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
|
|
factory StaffModel.fromJson(Map<String, dynamic> json) =>
|
|
_$StaffModelFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$StaffModelToJson(this);
|
|
|
|
UsersCompanion toDriftCompanion() {
|
|
return UsersCompanion(
|
|
localId: Value(serverId),
|
|
serverId: Value(serverId),
|
|
outletId: Value(outletId),
|
|
name: Value(name),
|
|
email: Value(email),
|
|
phoneNumber: Value(phoneNumber),
|
|
role: Value(role),
|
|
placeOfBirth: Value(placeOfBirth),
|
|
dateOfBirth: Value(dateOfBirth),
|
|
shiftName: Value(shiftName),
|
|
shiftStartTime: Value(shiftStartTime),
|
|
shiftEndTime: Value(shiftEndTime),
|
|
isActive: Value(isActive),
|
|
syncStatus: Value(SyncStatus.synced.status),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
}
|