add auth, format

This commit is contained in:
Phuoc Nguyen
2025-11-07 11:52:06 +07:00
parent 24a8508fce
commit 3803bd26e0
173 changed files with 8505 additions and 7116 deletions

View File

@@ -6,18 +6,39 @@ part 'audit_log_model.g.dart';
@HiveType(typeId: HiveTypeIds.auditLogModel)
class AuditLogModel extends HiveObject {
AuditLogModel({required this.logId, required this.userId, required this.action, required this.entityType, required this.entityId, this.oldValue, this.newValue, this.ipAddress, this.userAgent, required this.timestamp});
@HiveField(0) final int logId;
@HiveField(1) final String userId;
@HiveField(2) final String action;
@HiveField(3) final String entityType;
@HiveField(4) final String entityId;
@HiveField(5) final String? oldValue;
@HiveField(6) final String? newValue;
@HiveField(7) final String? ipAddress;
@HiveField(8) final String? userAgent;
@HiveField(9) final DateTime timestamp;
AuditLogModel({
required this.logId,
required this.userId,
required this.action,
required this.entityType,
required this.entityId,
this.oldValue,
this.newValue,
this.ipAddress,
this.userAgent,
required this.timestamp,
});
@HiveField(0)
final int logId;
@HiveField(1)
final String userId;
@HiveField(2)
final String action;
@HiveField(3)
final String entityType;
@HiveField(4)
final String entityId;
@HiveField(5)
final String? oldValue;
@HiveField(6)
final String? newValue;
@HiveField(7)
final String? ipAddress;
@HiveField(8)
final String? userAgent;
@HiveField(9)
final DateTime timestamp;
factory AuditLogModel.fromJson(Map<String, dynamic> json) => AuditLogModel(
logId: json['log_id'] as int,

View File

@@ -6,33 +6,65 @@ part 'payment_reminder_model.g.dart';
@HiveType(typeId: HiveTypeIds.paymentReminderModel)
class PaymentReminderModel extends HiveObject {
PaymentReminderModel({required this.reminderId, required this.invoiceId, required this.userId, required this.reminderType, required this.subject, required this.message, required this.isRead, required this.isSent, this.scheduledAt, this.sentAt, this.readAt});
@HiveField(0) final String reminderId;
@HiveField(1) final String invoiceId;
@HiveField(2) final String userId;
@HiveField(3) final ReminderType reminderType;
@HiveField(4) final String subject;
@HiveField(5) final String message;
@HiveField(6) final bool isRead;
@HiveField(7) final bool isSent;
@HiveField(8) final DateTime? scheduledAt;
@HiveField(9) final DateTime? sentAt;
@HiveField(10) final DateTime? readAt;
PaymentReminderModel({
required this.reminderId,
required this.invoiceId,
required this.userId,
required this.reminderType,
required this.subject,
required this.message,
required this.isRead,
required this.isSent,
this.scheduledAt,
this.sentAt,
this.readAt,
});
factory PaymentReminderModel.fromJson(Map<String, dynamic> json) => PaymentReminderModel(
reminderId: json['reminder_id'] as String,
invoiceId: json['invoice_id'] as String,
userId: json['user_id'] as String,
reminderType: ReminderType.values.firstWhere((e) => e.name == json['reminder_type']),
subject: json['subject'] as String,
message: json['message'] as String,
isRead: json['is_read'] as bool? ?? false,
isSent: json['is_sent'] as bool? ?? false,
scheduledAt: json['scheduled_at'] != null ? DateTime.parse(json['scheduled_at']?.toString() ?? '') : null,
sentAt: json['sent_at'] != null ? DateTime.parse(json['sent_at']?.toString() ?? '') : null,
readAt: json['read_at'] != null ? DateTime.parse(json['read_at']?.toString() ?? '') : null,
);
@HiveField(0)
final String reminderId;
@HiveField(1)
final String invoiceId;
@HiveField(2)
final String userId;
@HiveField(3)
final ReminderType reminderType;
@HiveField(4)
final String subject;
@HiveField(5)
final String message;
@HiveField(6)
final bool isRead;
@HiveField(7)
final bool isSent;
@HiveField(8)
final DateTime? scheduledAt;
@HiveField(9)
final DateTime? sentAt;
@HiveField(10)
final DateTime? readAt;
factory PaymentReminderModel.fromJson(Map<String, dynamic> json) =>
PaymentReminderModel(
reminderId: json['reminder_id'] as String,
invoiceId: json['invoice_id'] as String,
userId: json['user_id'] as String,
reminderType: ReminderType.values.firstWhere(
(e) => e.name == json['reminder_type'],
),
subject: json['subject'] as String,
message: json['message'] as String,
isRead: json['is_read'] as bool? ?? false,
isSent: json['is_sent'] as bool? ?? false,
scheduledAt: json['scheduled_at'] != null
? DateTime.parse(json['scheduled_at']?.toString() ?? '')
: null,
sentAt: json['sent_at'] != null
? DateTime.parse(json['sent_at']?.toString() ?? '')
: null,
readAt: json['read_at'] != null
? DateTime.parse(json['read_at']?.toString() ?? '')
: null,
);
Map<String, dynamic> toJson() => {
'reminder_id': reminderId,

View File

@@ -134,13 +134,7 @@ class AuditLog {
@override
int get hashCode {
return Object.hash(
logId,
userId,
action,
entityType,
entityId,
);
return Object.hash(logId, userId, action, entityType, entityId);
}
@override

View File

@@ -59,10 +59,7 @@ class AccountMenuItem extends StatelessWidget {
),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: AppColors.grey100,
width: 1.0,
),
bottom: BorderSide(color: AppColors.grey100, width: 1.0),
),
),
child: Row(
@@ -72,7 +69,9 @@ class AccountMenuItem extends StatelessWidget {
width: 40,
height: 40,
decoration: BoxDecoration(
color: iconBackgroundColor ?? AppColors.lightBlue.withValues(alpha: 0.1),
color:
iconBackgroundColor ??
AppColors.lightBlue.withValues(alpha: 0.1),
shape: BoxShape.circle,
),
child: Icon(