File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,14 @@ export class AppealController {
77
77
this . logger . log ( `Creating appeal` ) ;
78
78
const authUser = req [ 'user' ] as JwtUser ;
79
79
try {
80
+ const trimmedContent = body . content ?. trim ( ) ;
81
+ if ( ! trimmedContent ) {
82
+ throw new BadRequestException ( {
83
+ message : 'Appeal content must not be empty.' ,
84
+ code : 'EMPTY_APPEAL_CONTENT' ,
85
+ } ) ;
86
+ }
87
+
80
88
// Get challengeId by following the relationship chain
81
89
const reviewItemComment =
82
90
await this . prisma . reviewItemComment . findUniqueOrThrow ( {
@@ -116,7 +124,7 @@ export class AppealController {
116
124
await this . challengeApiService . validateAppealSubmission ( challengeId ) ;
117
125
118
126
const data = await this . prisma . appeal . create ( {
119
- data : { ...body } ,
127
+ data : { ...body , content : trimmedContent } ,
120
128
} ) ;
121
129
this . logger . log ( `Appeal created with ID: ${ data . id } ` ) ;
122
130
return data as AppealResponseDto ;
You can’t perform that action at this time.
0 commit comments