From 3e8bf01018201dfbd1f5825556b4dc8e7cf53a09 Mon Sep 17 00:00:00 2001 From: minhhieu2312 Date: Fri, 27 Feb 2026 10:43:24 +0700 Subject: [PATCH] =?UTF-8?q?T=C3=A0i=20kho=E1=BA=A3n=20ok?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/features/repositories/hra_repository.dart | 27 +- .../repositories/hra_repository.g.dart | 106 ++++- .../repositories/hra_repository_enums.dart | 31 +- .../repositories/hra_repository_models.dart | 394 ++++++++++++++++++ .../repositories/hra_repository_models.g.dart | 265 ++++++++++++ .../usecases/user/user_use_cases.dart | 4 +- 6 files changed, 816 insertions(+), 11 deletions(-) diff --git a/lib/features/repositories/hra_repository.dart b/lib/features/repositories/hra_repository.dart index 94283c2..06f0718 100644 --- a/lib/features/repositories/hra_repository.dart +++ b/lib/features/repositories/hra_repository.dart @@ -444,6 +444,11 @@ abstract class HraRepository { @POST('/api/v1/class/save') Future classSave(@Body() ClassEntity body); + /// + @POST('/api/v1/class/link-product') + Future classLinkProduct( + @Body() ClassLinkProductCommand body); + /// ///@param id @DELETE('/api/v1/class/delete') @@ -944,7 +949,7 @@ abstract class HraRepository { /// @POST('/api/v1/order/create') - Future orderCreate(@Body() OrderCreateDto body); + Future orderCreate(@Body() OrderCreateDto body); /// @POST('/api/v1/order/list') @@ -990,6 +995,20 @@ abstract class HraRepository { Future orderCreateWithClass( @Body() OrderCreateWithClassDto body); + /// + ///@param id + @GET('/api/v1/order/check-paid/{id}') + Future orderCheckPaidId(@Path('id') int id); + + /// + ///@param id + @GET('/api/v1/order/payment/{id}') + Future orderPaymentId(@Path('id') int id); + + /// + @POST('/api/v1/order/sepay-webhook') + Future orderSepayWebhook(@Body() SePayNotifyResource body); + /// ///@param id @GET('/api/v1/product/{id}') @@ -997,8 +1016,12 @@ abstract class HraRepository { /// ///@param id + ///@param classId @GET('/api/v1/product/detail/{id}') - Future productDetailId(@Path('id') int id); + Future productDetailId( + @Path('id') int id, + @Query('classId') int classId, + ); /// @POST('/api/v1/product') diff --git a/lib/features/repositories/hra_repository.g.dart b/lib/features/repositories/hra_repository.g.dart index 776b35d..a92797d 100644 --- a/lib/features/repositories/hra_repository.g.dart +++ b/lib/features/repositories/hra_repository.g.dart @@ -1985,6 +1985,30 @@ class _HraRepository implements HraRepository { return value; } + @override + Future classLinkProduct(body) async { + const _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(body.toJson()); + final _result = await _dio + .fetch>(_setStreamType(Options( + method: 'POST', + headers: _headers, + extra: _extra, + ) + .compose( + _dio.options, + '/api/v1/class/link-product', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: baseUrl ?? _dio.options.baseUrl))); + final value = BooleanApiResponse.fromJson(_result.data!); + return value; + } + @override Future classDelete(id) async { const _extra = {}; @@ -4256,14 +4280,14 @@ class _HraRepository implements HraRepository { } @override - Future orderCreate(body) async { + Future orderCreate(body) async { const _extra = {}; final queryParameters = {}; final _headers = {}; final _data = {}; _data.addAll(body.toJson()); final _result = await _dio.fetch>( - _setStreamType(Options( + _setStreamType(Options( method: 'POST', headers: _headers, extra: _extra, @@ -4275,7 +4299,7 @@ class _HraRepository implements HraRepository { data: _data, ) .copyWith(baseUrl: baseUrl ?? _dio.options.baseUrl))); - final value = OrderDtoApiResponse.fromJson(_result.data!); + final value = OrderPaymentDtoApiResponse.fromJson(_result.data!); return value; } @@ -4453,6 +4477,75 @@ class _HraRepository implements HraRepository { return value; } + @override + Future orderCheckPaidId(id) async { + const _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + final _result = await _dio + .fetch>(_setStreamType(Options( + method: 'GET', + headers: _headers, + extra: _extra, + ) + .compose( + _dio.options, + '/api/v1/order/check-paid/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: baseUrl ?? _dio.options.baseUrl))); + final value = BooleanApiResponse.fromJson(_result.data!); + return value; + } + + @override + Future orderPaymentId(id) async { + const _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + final _result = await _dio.fetch>( + _setStreamType(Options( + method: 'GET', + headers: _headers, + extra: _extra, + ) + .compose( + _dio.options, + '/api/v1/order/payment/${id}', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: baseUrl ?? _dio.options.baseUrl))); + final value = OrderPaymentDtoApiResponse.fromJson(_result.data!); + return value; + } + + @override + Future orderSepayWebhook(body) async { + const _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(body.toJson()); + final _result = await _dio.fetch(_setStreamType(Options( + method: 'POST', + headers: _headers, + extra: _extra, + ) + .compose( + _dio.options, + '/api/v1/order/sepay-webhook', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: baseUrl ?? _dio.options.baseUrl))); + final value = _result.data!; + return value; + } + @override Future productId(id) async { const _extra = {}; @@ -4477,9 +4570,12 @@ class _HraRepository implements HraRepository { } @override - Future productDetailId(id) async { + Future productDetailId( + id, + classId, + ) async { const _extra = {}; - final queryParameters = {}; + final queryParameters = {r'classId': classId}; final _headers = {}; final _data = {}; final _result = await _dio.fetch>( diff --git a/lib/features/repositories/hra_repository_enums.dart b/lib/features/repositories/hra_repository_enums.dart index 629611f..c784598 100644 --- a/lib/features/repositories/hra_repository_enums.dart +++ b/lib/features/repositories/hra_repository_enums.dart @@ -96,6 +96,27 @@ const $ClassListSearchTypeEnumMap = { ClassListSearchTypeEnum.swaggerGeneratedUnknown: '' }; +enum ClassProductStatusEnum { + @JsonValue('swaggerGeneratedUnknown') + swaggerGeneratedUnknown, + @JsonValue('1') + value_1, + @JsonValue('2') + value_2, + @JsonValue('3') + value_3, + @JsonValue('4') + value_4 +} + +const $ClassProductStatusEnumMap = { + ClassProductStatusEnum.value_1: '1', + ClassProductStatusEnum.value_2: '2', + ClassProductStatusEnum.value_3: '3', + ClassProductStatusEnum.value_4: '4', + ClassProductStatusEnum.swaggerGeneratedUnknown: '' +}; + enum ClassStatusEnum { @JsonValue('swaggerGeneratedUnknown') swaggerGeneratedUnknown, @@ -157,7 +178,9 @@ enum ClassUserStatusEnum { @JsonValue('3') value_3, @JsonValue('4') - value_4 + value_4, + @JsonValue('5') + value_5 } const $ClassUserStatusEnumMap = { @@ -165,6 +188,7 @@ const $ClassUserStatusEnumMap = { ClassUserStatusEnum.value_2: '2', ClassUserStatusEnum.value_3: '3', ClassUserStatusEnum.value_4: '4', + ClassUserStatusEnum.value_5: '5', ClassUserStatusEnum.swaggerGeneratedUnknown: '' }; @@ -731,7 +755,9 @@ enum OrderStatusEnum { @JsonValue('4') value_4, @JsonValue('5') - value_5 + value_5, + @JsonValue('6') + value_6 } const $OrderStatusEnumMap = { @@ -741,6 +767,7 @@ const $OrderStatusEnumMap = { OrderStatusEnum.value_3: '3', OrderStatusEnum.value_4: '4', OrderStatusEnum.value_5: '5', + OrderStatusEnum.value_6: '6', OrderStatusEnum.swaggerGeneratedUnknown: '' }; diff --git a/lib/features/repositories/hra_repository_models.dart b/lib/features/repositories/hra_repository_models.dart index 8898570..12d6d83 100644 --- a/lib/features/repositories/hra_repository_models.dart +++ b/lib/features/repositories/hra_repository_models.dart @@ -3369,6 +3369,7 @@ class ClassDetailDto { this.zoomMeetingId, this.zoomPassword, this.description, + this.allowRegistration, this.zoomHostVideo, this.zoomParticipantVideo, this.zoomJoinBeforeHost, @@ -3377,7 +3378,9 @@ class ClassDetailDto { this.classUsers, this.assignExams, this.classSessions, + this.classProducts, this.currentRole, + this.products, }); factory ClassDetailDto.fromJson(Map json) => @@ -3433,6 +3436,8 @@ class ClassDetailDto { String? zoomPassword; @JsonKey(name: 'description', includeIfNull: true) String? description; + @JsonKey(name: 'allowRegistration', includeIfNull: true) + bool? allowRegistration; @JsonKey(name: 'zoomHostVideo', includeIfNull: true) bool? zoomHostVideo; @JsonKey(name: 'zoomParticipantVideo', includeIfNull: true) @@ -3458,12 +3463,20 @@ class ClassDetailDto { includeIfNull: true, defaultValue: []) List? classSessions; + @JsonKey( + name: 'classProducts', + includeIfNull: true, + defaultValue: []) + List? classProducts; @JsonKey( name: 'currentRole', includeIfNull: true, toJson: classUserRoleEnumToJson, fromJson: classUserRoleEnumFromJson) enums.ClassUserRoleEnum? currentRole; + @JsonKey( + name: 'products', includeIfNull: true, defaultValue: []) + List? products; static const fromJsonFactory = _$ClassDetailDtoFromJson; static const toJsonFactory = _$ClassDetailDtoToJson; Map toJson() => _$ClassDetailDtoToJson(this); @@ -3493,6 +3506,7 @@ class ClassEntity { this.zoomMeetingId, this.zoomPassword, this.description, + this.allowRegistration, this.zoomHostVideo, this.zoomParticipantVideo, this.zoomJoinBeforeHost, @@ -3501,6 +3515,7 @@ class ClassEntity { this.classUsers, this.assignExams, this.classSessions, + this.classProducts, }); factory ClassEntity.fromJson(Map json) => @@ -3556,6 +3571,8 @@ class ClassEntity { String? zoomPassword; @JsonKey(name: 'description', includeIfNull: true) String? description; + @JsonKey(name: 'allowRegistration', includeIfNull: true) + bool? allowRegistration; @JsonKey(name: 'zoomHostVideo', includeIfNull: true) bool? zoomHostVideo; @JsonKey(name: 'zoomParticipantVideo', includeIfNull: true) @@ -3581,6 +3598,11 @@ class ClassEntity { includeIfNull: true, defaultValue: []) List? classSessions; + @JsonKey( + name: 'classProducts', + includeIfNull: true, + defaultValue: []) + List? classProducts; static const fromJsonFactory = _$ClassEntityFromJson; static const toJsonFactory = _$ClassEntityToJson; Map toJson() => _$ClassEntityToJson(this); @@ -3675,6 +3697,31 @@ class ClassLevel { Map toJson() => _$ClassLevelToJson(this); } +@JsonSerializable(explicitToJson: true) +class ClassLinkProductCommand { + ClassLinkProductCommand({ + this.classId, + this.productId, + this.classSessions, + }); + + factory ClassLinkProductCommand.fromJson(Map json) => + _$ClassLinkProductCommandFromJson(json); + + @JsonKey(name: 'classId', includeIfNull: true) + int? classId; + @JsonKey(name: 'productId', includeIfNull: true) + int? productId; + @JsonKey( + name: 'classSessions', + includeIfNull: true, + defaultValue: []) + List? classSessions; + static const fromJsonFactory = _$ClassLinkProductCommandFromJson; + static const toJsonFactory = _$ClassLinkProductCommandToJson; + Map toJson() => _$ClassLinkProductCommandToJson(this); +} + @JsonSerializable(explicitToJson: true) class ClassListDto { ClassListDto({ @@ -3699,6 +3746,7 @@ class ClassListDto { this.zoomMeetingId, this.zoomPassword, this.description, + this.allowRegistration, this.zoomHostVideo, this.zoomParticipantVideo, this.zoomJoinBeforeHost, @@ -3707,6 +3755,7 @@ class ClassListDto { this.classUsers, this.assignExams, this.classSessions, + this.classProducts, this.countPupil, this.countExercise, this.countTest, @@ -3773,6 +3822,8 @@ class ClassListDto { String? zoomPassword; @JsonKey(name: 'description', includeIfNull: true) String? description; + @JsonKey(name: 'allowRegistration', includeIfNull: true) + bool? allowRegistration; @JsonKey(name: 'zoomHostVideo', includeIfNull: true) bool? zoomHostVideo; @JsonKey(name: 'zoomParticipantVideo', includeIfNull: true) @@ -3798,6 +3849,11 @@ class ClassListDto { includeIfNull: true, defaultValue: []) List? classSessions; + @JsonKey( + name: 'classProducts', + includeIfNull: true, + defaultValue: []) + List? classProducts; @JsonKey(name: 'countPupil', includeIfNull: true) int? countPupil; @JsonKey(name: 'countExercise', includeIfNull: true) @@ -3948,6 +4004,71 @@ class ClassListOfSchoolFilter { Map toJson() => _$ClassListOfSchoolFilterToJson(this); } +@JsonSerializable(explicitToJson: true) +class ClassProductEntity { + ClassProductEntity({ + this.id, + this.createdBy, + this.createdDate, + this.lastModifiedBy, + this.lastModifiedDate, + this.isDeleted, + this.classId, + this.productId, + this.maxStudents, + this.startDate, + this.endDate, + this.status, + this.zoomMeetingId, + this.zoomPassword, + this.description, + this.sortOrder, + }); + + factory ClassProductEntity.fromJson(Map json) => + _$ClassProductEntityFromJson(json); + + @JsonKey(name: 'id', includeIfNull: true) + int? id; + @JsonKey(name: 'createdBy', includeIfNull: true) + int? createdBy; + @JsonKey(name: 'createdDate', includeIfNull: true) + DateTime? createdDate; + @JsonKey(name: 'lastModifiedBy', includeIfNull: true) + int? lastModifiedBy; + @JsonKey(name: 'lastModifiedDate', includeIfNull: true) + DateTime? lastModifiedDate; + @JsonKey(name: 'isDeleted', includeIfNull: true) + bool? isDeleted; + @JsonKey(name: 'classId', includeIfNull: true) + int? classId; + @JsonKey(name: 'productId', includeIfNull: true) + int? productId; + @JsonKey(name: 'maxStudents', includeIfNull: true) + int? maxStudents; + @JsonKey(name: 'startDate', includeIfNull: true) + DateTime? startDate; + @JsonKey(name: 'endDate', includeIfNull: true) + DateTime? endDate; + @JsonKey( + name: 'status', + includeIfNull: true, + toJson: classProductStatusEnumToJson, + fromJson: classProductStatusEnumFromJson) + enums.ClassProductStatusEnum? status; + @JsonKey(name: 'zoomMeetingId', includeIfNull: true) + String? zoomMeetingId; + @JsonKey(name: 'zoomPassword', includeIfNull: true) + String? zoomPassword; + @JsonKey(name: 'description', includeIfNull: true) + String? description; + @JsonKey(name: 'sortOrder', includeIfNull: true) + int? sortOrder; + static const fromJsonFactory = _$ClassProductEntityFromJson; + static const toJsonFactory = _$ClassProductEntityToJson; + Map toJson() => _$ClassProductEntityToJson(this); +} + @JsonSerializable(explicitToJson: true) class ClassProgramTypeEntity { ClassProgramTypeEntity({ @@ -4298,6 +4419,65 @@ class ClassSessionEntity { Map toJson() => _$ClassSessionEntityToJson(this); } +@JsonSerializable(explicitToJson: true) +class ClassSessionInfoDto { + ClassSessionInfoDto({ + this.id, + this.sessionNumber, + this.sessionName, + this.description, + this.startTime, + this.endTime, + this.zoomMeetingId, + this.zoomJoinLink, + this.zoomStartLink, + this.zoomPassword, + this.recordingUrl, + this.actualDurationMinutes, + this.status, + this.notes, + }); + + factory ClassSessionInfoDto.fromJson(Map json) => + _$ClassSessionInfoDtoFromJson(json); + + @JsonKey(name: 'id', includeIfNull: true) + int? id; + @JsonKey(name: 'sessionNumber', includeIfNull: true) + int? sessionNumber; + @JsonKey(name: 'sessionName', includeIfNull: true) + String? sessionName; + @JsonKey(name: 'description', includeIfNull: true) + String? description; + @JsonKey(name: 'startTime', includeIfNull: true) + DateTime? startTime; + @JsonKey(name: 'endTime', includeIfNull: true) + DateTime? endTime; + @JsonKey(name: 'zoomMeetingId', includeIfNull: true) + String? zoomMeetingId; + @JsonKey(name: 'zoomJoinLink', includeIfNull: true) + String? zoomJoinLink; + @JsonKey(name: 'zoomStartLink', includeIfNull: true) + String? zoomStartLink; + @JsonKey(name: 'zoomPassword', includeIfNull: true) + String? zoomPassword; + @JsonKey(name: 'recordingUrl', includeIfNull: true) + String? recordingUrl; + @JsonKey(name: 'actualDurationMinutes', includeIfNull: true) + int? actualDurationMinutes; + @JsonKey( + name: 'status', + includeIfNull: true, + toJson: sessionStatusEnumToJson, + fromJson: sessionStatusEnumFromJson) + enums.SessionStatusEnum? status; + @JsonKey(name: 'notes', includeIfNull: true) + String? notes; + static const fromJsonFactory = _$ClassSessionInfoDtoFromJson; + static const toJsonFactory = _$ClassSessionInfoDtoToJson; + Map toJson() => _$ClassSessionInfoDtoToJson(this); +} + @JsonSerializable(explicitToJson: true) class ClassShortDto { ClassShortDto({ @@ -9815,6 +9995,8 @@ class OrderDto { this.address, this.notes, this.totalAmount, + this.paidDate, + this.paymentLog, this.status, this.items, }); @@ -9846,6 +10028,10 @@ class OrderDto { String? notes; @JsonKey(name: 'totalAmount', includeIfNull: true) double? totalAmount; + @JsonKey(name: 'paidDate', includeIfNull: true) + DateTime? paidDate; + @JsonKey(name: 'paymentLog', includeIfNull: true) + String? paymentLog; @JsonKey( name: 'status', includeIfNull: true, @@ -9952,6 +10138,8 @@ class OrderEntity { this.address, this.notes, this.totalAmount, + this.paidDate, + this.paymentLog, this.status, this.items, }); @@ -9983,6 +10171,10 @@ class OrderEntity { String? notes; @JsonKey(name: 'totalAmount', includeIfNull: true) double? totalAmount; + @JsonKey(name: 'paidDate', includeIfNull: true) + DateTime? paidDate; + @JsonKey(name: 'paymentLog', includeIfNull: true) + String? paymentLog; @JsonKey( name: 'status', includeIfNull: true, @@ -10160,6 +10352,116 @@ class OrderItemEntity { Map toJson() => _$OrderItemEntityToJson(this); } +@JsonSerializable(explicitToJson: true) +class OrderPaymentDto { + OrderPaymentDto({ + this.id, + this.createdBy, + this.createdDate, + this.lastModifiedBy, + this.lastModifiedDate, + this.isDeleted, + this.userId, + this.fullName, + this.phone, + this.address, + this.notes, + this.totalAmount, + this.paidDate, + this.paymentLog, + this.status, + this.items, + this.bankName, + this.bankNumber, + this.accountName, + this.content, + this.gatewayUrl, + }); + + factory OrderPaymentDto.fromJson(Map json) => + _$OrderPaymentDtoFromJson(json); + + @JsonKey(name: 'id', includeIfNull: true) + int? id; + @JsonKey(name: 'createdBy', includeIfNull: true) + int? createdBy; + @JsonKey(name: 'createdDate', includeIfNull: true) + DateTime? createdDate; + @JsonKey(name: 'lastModifiedBy', includeIfNull: true) + int? lastModifiedBy; + @JsonKey(name: 'lastModifiedDate', includeIfNull: true) + DateTime? lastModifiedDate; + @JsonKey(name: 'isDeleted', includeIfNull: true) + bool? isDeleted; + @JsonKey(name: 'userId', includeIfNull: true) + int? userId; + @JsonKey(name: 'fullName', includeIfNull: true) + String? fullName; + @JsonKey(name: 'phone', includeIfNull: true) + String? phone; + @JsonKey(name: 'address', includeIfNull: true) + String? address; + @JsonKey(name: 'notes', includeIfNull: true) + String? notes; + @JsonKey(name: 'totalAmount', includeIfNull: true) + double? totalAmount; + @JsonKey(name: 'paidDate', includeIfNull: true) + DateTime? paidDate; + @JsonKey(name: 'paymentLog', includeIfNull: true) + String? paymentLog; + @JsonKey( + name: 'status', + includeIfNull: true, + toJson: orderStatusEnumToJson, + fromJson: orderStatusEnumFromJson) + enums.OrderStatusEnum? status; + @JsonKey( + name: 'items', includeIfNull: true, defaultValue: []) + List? items; + @JsonKey(name: 'bankName', includeIfNull: true) + String? bankName; + @JsonKey(name: 'bankNumber', includeIfNull: true) + String? bankNumber; + @JsonKey(name: 'accountName', includeIfNull: true) + String? accountName; + @JsonKey(name: 'content', includeIfNull: true) + String? content; + @JsonKey(name: 'gatewayUrl', includeIfNull: true) + String? gatewayUrl; + static const fromJsonFactory = _$OrderPaymentDtoFromJson; + static const toJsonFactory = _$OrderPaymentDtoToJson; + Map toJson() => _$OrderPaymentDtoToJson(this); +} + +@JsonSerializable(explicitToJson: true) +class OrderPaymentDtoApiResponse { + OrderPaymentDtoApiResponse({ + this.data, + this.message, + this.success, + this.code, + }); + + factory OrderPaymentDtoApiResponse.fromJson(Map json) => + _$OrderPaymentDtoApiResponseFromJson(json); + + @JsonKey(name: 'data', includeIfNull: true) + OrderPaymentDto? data; + @JsonKey(name: 'message', includeIfNull: true) + String? message; + @JsonKey(name: 'success', includeIfNull: true) + bool? success; + @JsonKey( + name: 'code', + includeIfNull: true, + toJson: errorCodeEnumToJson, + fromJson: errorCodeEnumFromJson) + enums.ErrorCodeEnum? code; + static const fromJsonFactory = _$OrderPaymentDtoApiResponseFromJson; + static const toJsonFactory = _$OrderPaymentDtoApiResponseToJson; + Map toJson() => _$OrderPaymentDtoApiResponseToJson(this); +} + @JsonSerializable(explicitToJson: true) class OrderUpdateDto { OrderUpdateDto({ @@ -10812,6 +11114,7 @@ class ProductLessonDetailDto { this.content, this.sortOrder, this.isFree, + this.classSession, }); factory ProductLessonDetailDto.fromJson(Map json) => @@ -10847,6 +11150,8 @@ class ProductLessonDetailDto { int? sortOrder; @JsonKey(name: 'isFree', includeIfNull: true) bool? isFree; + @JsonKey(name: 'classSession', includeIfNull: true) + ClassSessionInfoDto? classSession; static const fromJsonFactory = _$ProductLessonDetailDtoFromJson; static const toJsonFactory = _$ProductLessonDetailDtoToJson; Map toJson() => _$ProductLessonDetailDtoToJson(this); @@ -12661,6 +12966,7 @@ class RefreshTokenRequestDto { class RefreshTokenResponseDto { RefreshTokenResponseDto({ this.token, + this.refreshToken, }); factory RefreshTokenResponseDto.fromJson(Map json) => @@ -12668,6 +12974,8 @@ class RefreshTokenResponseDto { @JsonKey(name: 'token', includeIfNull: true) String? token; + @JsonKey(name: 'refreshToken', includeIfNull: true) + String? refreshToken; static const fromJsonFactory = _$RefreshTokenResponseDtoFromJson; static const toJsonFactory = _$RefreshTokenResponseDtoToJson; Map toJson() => _$RefreshTokenResponseDtoToJson(this); @@ -13803,6 +14111,49 @@ class SchoolStaticCountDtoApiResponse { _$SchoolStaticCountDtoApiResponseToJson(this); } +@JsonSerializable(explicitToJson: true) +class SePayNotifyResource { + SePayNotifyResource({ + this.id, + this.gateway, + this.transactionDate, + this.accountNumber, + this.code, + this.content, + this.transferType, + this.transferAmount, + this.referenceCode, + this.description, + }); + + factory SePayNotifyResource.fromJson(Map json) => + _$SePayNotifyResourceFromJson(json); + + @JsonKey(name: 'id', includeIfNull: true) + int? id; + @JsonKey(name: 'gateway', includeIfNull: true) + String? gateway; + @JsonKey(name: 'transactionDate', includeIfNull: true) + String? transactionDate; + @JsonKey(name: 'accountNumber', includeIfNull: true) + String? accountNumber; + @JsonKey(name: 'code', includeIfNull: true) + String? code; + @JsonKey(name: 'content', includeIfNull: true) + String? content; + @JsonKey(name: 'transferType', includeIfNull: true) + String? transferType; + @JsonKey(name: 'transferAmount', includeIfNull: true) + int? transferAmount; + @JsonKey(name: 'referenceCode', includeIfNull: true) + String? referenceCode; + @JsonKey(name: 'description', includeIfNull: true) + String? description; + static const fromJsonFactory = _$SePayNotifyResourceFromJson; + static const toJsonFactory = _$SePayNotifyResourceToJson; + Map toJson() => _$SePayNotifyResourceToJson(this); +} + @JsonSerializable(explicitToJson: true) class SessionAttendanceEntity { SessionAttendanceEntity({ @@ -16442,6 +16793,49 @@ List classListSearchTypeEnumListFromJson( .toList(); } +int? classProductStatusEnumToJson( + enums.ClassProductStatusEnum? classProductStatusEnum) { + return classProductStatusEnum?.index; +} + +enums.ClassProductStatusEnum classProductStatusEnumFromJson( + int? classProductStatusEnum) { + if (classProductStatusEnum == null) { + return enums.ClassProductStatusEnum.swaggerGeneratedUnknown; + } + + return enums.$ClassProductStatusEnumMap.entries + .firstWhere( + (element) => + element.value.toString().toLowerCase() == + classProductStatusEnum.toString().toLowerCase(), + orElse: () => const MapEntry( + enums.ClassProductStatusEnum.swaggerGeneratedUnknown, '')) + .key; +} + +List classProductStatusEnumListToJson( + List? classProductStatusEnum) { + if (classProductStatusEnum == null) { + return []; + } + + return classProductStatusEnum + .map((e) => e.index) //enums.$ClassProductStatusEnumMap[e]! + .toList(); +} + +List classProductStatusEnumListFromJson( + List? classProductStatusEnum) { + if (classProductStatusEnum == null) { + return []; + } + + return classProductStatusEnum + .map((e) => classProductStatusEnumFromJson(e)) //.toString() + .toList(); +} + int? classStatusEnumToJson(enums.ClassStatusEnum? classStatusEnum) { return classStatusEnum?.index; } diff --git a/lib/features/repositories/hra_repository_models.g.dart b/lib/features/repositories/hra_repository_models.g.dart index 054ad8a..2521746 100644 --- a/lib/features/repositories/hra_repository_models.g.dart +++ b/lib/features/repositories/hra_repository_models.g.dart @@ -2445,6 +2445,7 @@ ClassDetailDto _$ClassDetailDtoFromJson(Map json) => zoomMeetingId: json['zoomMeetingId'] as String?, zoomPassword: json['zoomPassword'] as String?, description: json['description'] as String?, + allowRegistration: json['allowRegistration'] as bool?, zoomHostVideo: json['zoomHostVideo'] as bool?, zoomParticipantVideo: json['zoomParticipantVideo'] as bool?, zoomJoinBeforeHost: json['zoomJoinBeforeHost'] as bool?, @@ -2463,8 +2464,17 @@ ClassDetailDto _$ClassDetailDtoFromJson(Map json) => (e) => ClassSessionEntity.fromJson(e as Map)) .toList() ?? [], + classProducts: (json['classProducts'] as List?) + ?.map( + (e) => ClassProductEntity.fromJson(e as Map)) + .toList() ?? + [], currentRole: classUserRoleEnumFromJson((json['currentRole'] as num?)?.toInt()), + products: (json['products'] as List?) + ?.map((e) => ProductListDto.fromJson(e as Map)) + .toList() ?? + [], ); Map _$ClassDetailDtoToJson(ClassDetailDto instance) => @@ -2490,6 +2500,7 @@ Map _$ClassDetailDtoToJson(ClassDetailDto instance) => 'zoomMeetingId': instance.zoomMeetingId, 'zoomPassword': instance.zoomPassword, 'description': instance.description, + 'allowRegistration': instance.allowRegistration, 'zoomHostVideo': instance.zoomHostVideo, 'zoomParticipantVideo': instance.zoomParticipantVideo, 'zoomJoinBeforeHost': instance.zoomJoinBeforeHost, @@ -2498,7 +2509,9 @@ Map _$ClassDetailDtoToJson(ClassDetailDto instance) => 'classUsers': instance.classUsers?.map((e) => e.toJson()).toList(), 'assignExams': instance.assignExams?.map((e) => e.toJson()).toList(), 'classSessions': instance.classSessions?.map((e) => e.toJson()).toList(), + 'classProducts': instance.classProducts?.map((e) => e.toJson()).toList(), 'currentRole': classUserRoleEnumToJson(instance.currentRole), + 'products': instance.products?.map((e) => e.toJson()).toList(), }; ClassEntity _$ClassEntityFromJson(Map json) => ClassEntity( @@ -2534,6 +2547,7 @@ ClassEntity _$ClassEntityFromJson(Map json) => ClassEntity( zoomMeetingId: json['zoomMeetingId'] as String?, zoomPassword: json['zoomPassword'] as String?, description: json['description'] as String?, + allowRegistration: json['allowRegistration'] as bool?, zoomHostVideo: json['zoomHostVideo'] as bool?, zoomParticipantVideo: json['zoomParticipantVideo'] as bool?, zoomJoinBeforeHost: json['zoomJoinBeforeHost'] as bool?, @@ -2552,6 +2566,11 @@ ClassEntity _$ClassEntityFromJson(Map json) => ClassEntity( (e) => ClassSessionEntity.fromJson(e as Map)) .toList() ?? [], + classProducts: (json['classProducts'] as List?) + ?.map( + (e) => ClassProductEntity.fromJson(e as Map)) + .toList() ?? + [], ); Map _$ClassEntityToJson(ClassEntity instance) => @@ -2577,6 +2596,7 @@ Map _$ClassEntityToJson(ClassEntity instance) => 'zoomMeetingId': instance.zoomMeetingId, 'zoomPassword': instance.zoomPassword, 'description': instance.description, + 'allowRegistration': instance.allowRegistration, 'zoomHostVideo': instance.zoomHostVideo, 'zoomParticipantVideo': instance.zoomParticipantVideo, 'zoomJoinBeforeHost': instance.zoomJoinBeforeHost, @@ -2585,6 +2605,7 @@ Map _$ClassEntityToJson(ClassEntity instance) => 'classUsers': instance.classUsers?.map((e) => e.toJson()).toList(), 'assignExams': instance.assignExams?.map((e) => e.toJson()).toList(), 'classSessions': instance.classSessions?.map((e) => e.toJson()).toList(), + 'classProducts': instance.classProducts?.map((e) => e.toJson()).toList(), }; ClassGetListFilter _$ClassGetListFilterFromJson(Map json) => @@ -2645,6 +2666,26 @@ Map _$ClassLevelToJson(ClassLevel instance) => 'subjects': instance.subjects?.map((e) => e.toJson()).toList(), }; +ClassLinkProductCommand _$ClassLinkProductCommandFromJson( + Map json) => + ClassLinkProductCommand( + classId: (json['classId'] as num?)?.toInt(), + productId: (json['productId'] as num?)?.toInt(), + classSessions: (json['classSessions'] as List?) + ?.map( + (e) => ClassSessionEntity.fromJson(e as Map)) + .toList() ?? + [], + ); + +Map _$ClassLinkProductCommandToJson( + ClassLinkProductCommand instance) => + { + 'classId': instance.classId, + 'productId': instance.productId, + 'classSessions': instance.classSessions?.map((e) => e.toJson()).toList(), + }; + ClassListDto _$ClassListDtoFromJson(Map json) => ClassListDto( id: (json['id'] as num?)?.toInt(), createdBy: (json['createdBy'] as num?)?.toInt(), @@ -2678,6 +2719,7 @@ ClassListDto _$ClassListDtoFromJson(Map json) => ClassListDto( zoomMeetingId: json['zoomMeetingId'] as String?, zoomPassword: json['zoomPassword'] as String?, description: json['description'] as String?, + allowRegistration: json['allowRegistration'] as bool?, zoomHostVideo: json['zoomHostVideo'] as bool?, zoomParticipantVideo: json['zoomParticipantVideo'] as bool?, zoomJoinBeforeHost: json['zoomJoinBeforeHost'] as bool?, @@ -2696,6 +2738,11 @@ ClassListDto _$ClassListDtoFromJson(Map json) => ClassListDto( (e) => ClassSessionEntity.fromJson(e as Map)) .toList() ?? [], + classProducts: (json['classProducts'] as List?) + ?.map( + (e) => ClassProductEntity.fromJson(e as Map)) + .toList() ?? + [], countPupil: (json['countPupil'] as num?)?.toInt(), countExercise: (json['countExercise'] as num?)?.toInt(), countTest: (json['countTest'] as num?)?.toInt(), @@ -2733,6 +2780,7 @@ Map _$ClassListDtoToJson(ClassListDto instance) => 'zoomMeetingId': instance.zoomMeetingId, 'zoomPassword': instance.zoomPassword, 'description': instance.description, + 'allowRegistration': instance.allowRegistration, 'zoomHostVideo': instance.zoomHostVideo, 'zoomParticipantVideo': instance.zoomParticipantVideo, 'zoomJoinBeforeHost': instance.zoomJoinBeforeHost, @@ -2741,6 +2789,7 @@ Map _$ClassListDtoToJson(ClassListDto instance) => 'classUsers': instance.classUsers?.map((e) => e.toJson()).toList(), 'assignExams': instance.assignExams?.map((e) => e.toJson()).toList(), 'classSessions': instance.classSessions?.map((e) => e.toJson()).toList(), + 'classProducts': instance.classProducts?.map((e) => e.toJson()).toList(), 'countPupil': instance.countPupil, 'countExercise': instance.countExercise, 'countTest': instance.countTest, @@ -2846,6 +2895,54 @@ Map _$ClassListOfSchoolFilterToJson( 'grade': instance.grade, }; +ClassProductEntity _$ClassProductEntityFromJson(Map json) => + ClassProductEntity( + id: (json['id'] as num?)?.toInt(), + createdBy: (json['createdBy'] as num?)?.toInt(), + createdDate: json['createdDate'] == null + ? null + : DateTime.parse(json['createdDate'] as String), + lastModifiedBy: (json['lastModifiedBy'] as num?)?.toInt(), + lastModifiedDate: json['lastModifiedDate'] == null + ? null + : DateTime.parse(json['lastModifiedDate'] as String), + isDeleted: json['isDeleted'] as bool?, + classId: (json['classId'] as num?)?.toInt(), + productId: (json['productId'] as num?)?.toInt(), + maxStudents: (json['maxStudents'] as num?)?.toInt(), + startDate: json['startDate'] == null + ? null + : DateTime.parse(json['startDate'] as String), + endDate: json['endDate'] == null + ? null + : DateTime.parse(json['endDate'] as String), + status: classProductStatusEnumFromJson((json['status'] as num?)?.toInt()), + zoomMeetingId: json['zoomMeetingId'] as String?, + zoomPassword: json['zoomPassword'] as String?, + description: json['description'] as String?, + sortOrder: (json['sortOrder'] as num?)?.toInt(), + ); + +Map _$ClassProductEntityToJson(ClassProductEntity instance) => + { + 'id': instance.id, + 'createdBy': instance.createdBy, + 'createdDate': instance.createdDate?.toIso8601String(), + 'lastModifiedBy': instance.lastModifiedBy, + 'lastModifiedDate': instance.lastModifiedDate?.toIso8601String(), + 'isDeleted': instance.isDeleted, + 'classId': instance.classId, + 'productId': instance.productId, + 'maxStudents': instance.maxStudents, + 'startDate': instance.startDate?.toIso8601String(), + 'endDate': instance.endDate?.toIso8601String(), + 'status': classProductStatusEnumToJson(instance.status), + 'zoomMeetingId': instance.zoomMeetingId, + 'zoomPassword': instance.zoomPassword, + 'description': instance.description, + 'sortOrder': instance.sortOrder, + }; + ClassProgramTypeEntity _$ClassProgramTypeEntityFromJson( Map json) => ClassProgramTypeEntity( @@ -3106,6 +3203,47 @@ Map _$ClassSessionEntityToJson(ClassSessionEntity instance) => 'attendances': instance.attendances?.map((e) => e.toJson()).toList(), }; +ClassSessionInfoDto _$ClassSessionInfoDtoFromJson(Map json) => + ClassSessionInfoDto( + id: (json['id'] as num?)?.toInt(), + sessionNumber: (json['sessionNumber'] as num?)?.toInt(), + sessionName: json['sessionName'] as String?, + description: json['description'] as String?, + startTime: json['startTime'] == null + ? null + : DateTime.parse(json['startTime'] as String), + endTime: json['endTime'] == null + ? null + : DateTime.parse(json['endTime'] as String), + zoomMeetingId: json['zoomMeetingId'] as String?, + zoomJoinLink: json['zoomJoinLink'] as String?, + zoomStartLink: json['zoomStartLink'] as String?, + zoomPassword: json['zoomPassword'] as String?, + recordingUrl: json['recordingUrl'] as String?, + actualDurationMinutes: (json['actualDurationMinutes'] as num?)?.toInt(), + status: sessionStatusEnumFromJson((json['status'] as num?)?.toInt()), + notes: json['notes'] as String?, + ); + +Map _$ClassSessionInfoDtoToJson( + ClassSessionInfoDto instance) => + { + 'id': instance.id, + 'sessionNumber': instance.sessionNumber, + 'sessionName': instance.sessionName, + 'description': instance.description, + 'startTime': instance.startTime?.toIso8601String(), + 'endTime': instance.endTime?.toIso8601String(), + 'zoomMeetingId': instance.zoomMeetingId, + 'zoomJoinLink': instance.zoomJoinLink, + 'zoomStartLink': instance.zoomStartLink, + 'zoomPassword': instance.zoomPassword, + 'recordingUrl': instance.recordingUrl, + 'actualDurationMinutes': instance.actualDurationMinutes, + 'status': sessionStatusEnumToJson(instance.status), + 'notes': instance.notes, + }; + ClassShortDto _$ClassShortDtoFromJson(Map json) => ClassShortDto( id: (json['id'] as num?)?.toInt(), @@ -6973,6 +7111,10 @@ OrderDto _$OrderDtoFromJson(Map json) => OrderDto( address: json['address'] as String?, notes: json['notes'] as String?, totalAmount: (json['totalAmount'] as num?)?.toDouble(), + paidDate: json['paidDate'] == null + ? null + : DateTime.parse(json['paidDate'] as String), + paymentLog: json['paymentLog'] as String?, status: orderStatusEnumFromJson((json['status'] as num?)?.toInt()), items: (json['items'] as List?) ?.map((e) => OrderItemDto.fromJson(e as Map)) @@ -6993,6 +7135,8 @@ Map _$OrderDtoToJson(OrderDto instance) => { 'address': instance.address, 'notes': instance.notes, 'totalAmount': instance.totalAmount, + 'paidDate': instance.paidDate?.toIso8601String(), + 'paymentLog': instance.paymentLog, 'status': orderStatusEnumToJson(instance.status), 'items': instance.items?.map((e) => e.toJson()).toList(), }; @@ -7070,6 +7214,10 @@ OrderEntity _$OrderEntityFromJson(Map json) => OrderEntity( address: json['address'] as String?, notes: json['notes'] as String?, totalAmount: (json['totalAmount'] as num?)?.toDouble(), + paidDate: json['paidDate'] == null + ? null + : DateTime.parse(json['paidDate'] as String), + paymentLog: json['paymentLog'] as String?, status: orderStatusEnumFromJson((json['status'] as num?)?.toInt()), items: (json['items'] as List?) ?.map((e) => OrderItemEntity.fromJson(e as Map)) @@ -7091,6 +7239,8 @@ Map _$OrderEntityToJson(OrderEntity instance) => 'address': instance.address, 'notes': instance.notes, 'totalAmount': instance.totalAmount, + 'paidDate': instance.paidDate?.toIso8601String(), + 'paymentLog': instance.paymentLog, 'status': orderStatusEnumToJson(instance.status), 'items': instance.items?.map((e) => e.toJson()).toList(), }; @@ -7211,6 +7361,85 @@ Map _$OrderItemEntityToJson(OrderItemEntity instance) => 'product': instance.product?.toJson(), }; +OrderPaymentDto _$OrderPaymentDtoFromJson(Map json) => + OrderPaymentDto( + id: (json['id'] as num?)?.toInt(), + createdBy: (json['createdBy'] as num?)?.toInt(), + createdDate: json['createdDate'] == null + ? null + : DateTime.parse(json['createdDate'] as String), + lastModifiedBy: (json['lastModifiedBy'] as num?)?.toInt(), + lastModifiedDate: json['lastModifiedDate'] == null + ? null + : DateTime.parse(json['lastModifiedDate'] as String), + isDeleted: json['isDeleted'] as bool?, + userId: (json['userId'] as num?)?.toInt(), + fullName: json['fullName'] as String?, + phone: json['phone'] as String?, + address: json['address'] as String?, + notes: json['notes'] as String?, + totalAmount: (json['totalAmount'] as num?)?.toDouble(), + paidDate: json['paidDate'] == null + ? null + : DateTime.parse(json['paidDate'] as String), + paymentLog: json['paymentLog'] as String?, + status: orderStatusEnumFromJson((json['status'] as num?)?.toInt()), + items: (json['items'] as List?) + ?.map((e) => OrderItemEntity.fromJson(e as Map)) + .toList() ?? + [], + bankName: json['bankName'] as String?, + bankNumber: json['bankNumber'] as String?, + accountName: json['accountName'] as String?, + content: json['content'] as String?, + gatewayUrl: json['gatewayUrl'] as String?, + ); + +Map _$OrderPaymentDtoToJson(OrderPaymentDto instance) => + { + 'id': instance.id, + 'createdBy': instance.createdBy, + 'createdDate': instance.createdDate?.toIso8601String(), + 'lastModifiedBy': instance.lastModifiedBy, + 'lastModifiedDate': instance.lastModifiedDate?.toIso8601String(), + 'isDeleted': instance.isDeleted, + 'userId': instance.userId, + 'fullName': instance.fullName, + 'phone': instance.phone, + 'address': instance.address, + 'notes': instance.notes, + 'totalAmount': instance.totalAmount, + 'paidDate': instance.paidDate?.toIso8601String(), + 'paymentLog': instance.paymentLog, + 'status': orderStatusEnumToJson(instance.status), + 'items': instance.items?.map((e) => e.toJson()).toList(), + 'bankName': instance.bankName, + 'bankNumber': instance.bankNumber, + 'accountName': instance.accountName, + 'content': instance.content, + 'gatewayUrl': instance.gatewayUrl, + }; + +OrderPaymentDtoApiResponse _$OrderPaymentDtoApiResponseFromJson( + Map json) => + OrderPaymentDtoApiResponse( + data: json['data'] == null + ? null + : OrderPaymentDto.fromJson(json['data'] as Map), + message: json['message'] as String?, + success: json['success'] as bool?, + code: errorCodeEnumFromJson((json['code'] as num?)?.toInt()), + ); + +Map _$OrderPaymentDtoApiResponseToJson( + OrderPaymentDtoApiResponse instance) => + { + 'data': instance.data?.toJson(), + 'message': instance.message, + 'success': instance.success, + 'code': errorCodeEnumToJson(instance.code), + }; + OrderUpdateDto _$OrderUpdateDtoFromJson(Map json) => OrderUpdateDto( status: orderStatusEnumFromJson((json['status'] as num?)?.toInt()), @@ -7685,6 +7914,10 @@ ProductLessonDetailDto _$ProductLessonDetailDtoFromJson( content: json['content'] as String?, sortOrder: (json['sortOrder'] as num?)?.toInt(), isFree: json['isFree'] as bool?, + classSession: json['classSession'] == null + ? null + : ClassSessionInfoDto.fromJson( + json['classSession'] as Map), ); Map _$ProductLessonDetailDtoToJson( @@ -7703,6 +7936,7 @@ Map _$ProductLessonDetailDtoToJson( 'content': instance.content, 'sortOrder': instance.sortOrder, 'isFree': instance.isFree, + 'classSession': instance.classSession?.toJson(), }; ProductLessonEntity _$ProductLessonEntityFromJson(Map json) => @@ -8988,12 +9222,14 @@ RefreshTokenResponseDto _$RefreshTokenResponseDtoFromJson( Map json) => RefreshTokenResponseDto( token: json['token'] as String?, + refreshToken: json['refreshToken'] as String?, ); Map _$RefreshTokenResponseDtoToJson( RefreshTokenResponseDto instance) => { 'token': instance.token, + 'refreshToken': instance.refreshToken, }; RefreshTokenResponseDtoApiResponse _$RefreshTokenResponseDtoApiResponseFromJson( @@ -9772,6 +10008,35 @@ Map _$SchoolStaticCountDtoApiResponseToJson( 'code': errorCodeEnumToJson(instance.code), }; +SePayNotifyResource _$SePayNotifyResourceFromJson(Map json) => + SePayNotifyResource( + id: (json['id'] as num?)?.toInt(), + gateway: json['gateway'] as String?, + transactionDate: json['transactionDate'] as String?, + accountNumber: json['accountNumber'] as String?, + code: json['code'] as String?, + content: json['content'] as String?, + transferType: json['transferType'] as String?, + transferAmount: (json['transferAmount'] as num?)?.toInt(), + referenceCode: json['referenceCode'] as String?, + description: json['description'] as String?, + ); + +Map _$SePayNotifyResourceToJson( + SePayNotifyResource instance) => + { + 'id': instance.id, + 'gateway': instance.gateway, + 'transactionDate': instance.transactionDate, + 'accountNumber': instance.accountNumber, + 'code': instance.code, + 'content': instance.content, + 'transferType': instance.transferType, + 'transferAmount': instance.transferAmount, + 'referenceCode': instance.referenceCode, + 'description': instance.description, + }; + SessionAttendanceEntity _$SessionAttendanceEntityFromJson( Map json) => SessionAttendanceEntity( diff --git a/lib/features/usecases/user/user_use_cases.dart b/lib/features/usecases/user/user_use_cases.dart index 4b16900..d437819 100644 --- a/lib/features/usecases/user/user_use_cases.dart +++ b/lib/features/usecases/user/user_use_cases.dart @@ -77,7 +77,7 @@ class UserUseCases { final result = await _hraRepository.accountRefreshToken( RefreshTokenRequestDto(refreshToken: LocalStoreManager.getString(StorageKey.refreshToken))); if (result.data != null) { - await saveToken(result.data?.token ?? ''); + await saveToken(result.data?.token ?? '', refreshToken: result.data?.refreshToken ?? ''); } return Right(result.success ?? false); } catch (ex) { @@ -104,7 +104,7 @@ class UserUseCases { final RefreshTokenResponseDtoApiResponse? token = await HraRepository(Dio(), baseUrl: ApiPath.hra).accountRefreshToken(requestModel); if (token != null) { - await saveToken(token.data?.token ?? ''); + await saveToken(token.data?.token ?? '', refreshToken: token.data?.refreshToken ?? ''); } return token != null;