diff --git a/src/api/admin/admin.controller.ts b/src/api/admin/admin.controller.ts index 8b9ca26..0b95cb0 100644 --- a/src/api/admin/admin.controller.ts +++ b/src/api/admin/admin.controller.ts @@ -164,9 +164,14 @@ export class AdminController { @Body() body: WinningUpdateRequestDto, @User() user: UserInfo, ): Promise> { - if (!body.paymentAmount && !body.releaseDate && !body.paymentStatus) { + if ( + !body.paymentAmount && + !body.releaseDate && + !body.paymentStatus && + !body.description + ) { throw new BadRequestException( - 'paymentStatus, releaseDate and paymentAmount cannot be null at the same time.', + 'description, paymentStatus, releaseDate and paymentAmount cannot be null at the same time.', ); } diff --git a/src/api/admin/admin.service.ts b/src/api/admin/admin.service.ts index 38aabdf..f56d147 100644 --- a/src/api/admin/admin.service.ts +++ b/src/api/admin/admin.service.ts @@ -97,6 +97,30 @@ export class AdminService { } let version = payment.version ?? 1; + + if (body.description) { + transactions.push((tx) => + tx.payment.update({ + where: { + payment_id: payment.payment_id, + version: version, + }, + data: { + winnings: { + update: { + data: { + description: body.description, + }, + }, + }, + updated_at: new Date(), + updated_by: userId, + version: version++, + }, + }), + ); + } + let paymentStatus = payment.payment_status as PaymentStatus; // Update Payment Status if requested if (body.paymentStatus) { diff --git a/src/api/admin/dto/winnings.dto.ts b/src/api/admin/dto/winnings.dto.ts index a768d8f..367851a 100644 --- a/src/api/admin/dto/winnings.dto.ts +++ b/src/api/admin/dto/winnings.dto.ts @@ -19,6 +19,14 @@ export class WinningUpdateRequestDto { @IsUUID() winningsId: string; + @ApiProperty({ + description: 'Payment description', + example: 'Task Payment', + }) + @IsOptional() + @IsString() + description: string; + @ApiProperty({ description: 'The audit note', example: 'audit note',