File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -273,7 +273,9 @@ const getReports = async ({
273273 assignedStaffId : assignedFilter ,
274274
275275 ...( guildId !== undefined && { guildId : BigInt ( guildId ) } ) ,
276- ...( filterByUser !== undefined && { reportingUserId : BigInt ( filterByUser ) } ) ,
276+ ...( filterByUser !== undefined && {
277+ reportingUserId : BigInt ( filterByUser ) ,
278+ } ) ,
277279 } ,
278280 orderBy : {
279281 createdAt : "desc" ,
@@ -557,6 +559,10 @@ const createReportMessage = async ({
557559 ReportMessages : true ,
558560 } ,
559561 } ) ;
562+ // validate content
563+ if ( content . length < 1 ) {
564+ throw new BadRequest ( "Content must not be empty" )
565+ }
560566 if ( report === null ) {
561567 throw new NotFound ( "report not found" ) ;
562568 }
@@ -842,7 +848,7 @@ const closeReport = async ({
842848 instance : FastifyInstance ;
843849 user : UserRequestData ;
844850 reportId : string ;
845- staffReportReason : string ;
851+ staffReportReason ? : string ;
846852 messageToReportingUser : string ;
847853 closeStatus : ReportCloseStatusEnum ;
848854} ) => {
@@ -881,7 +887,7 @@ const closeReport = async ({
881887 } ,
882888 } ) ;
883889
884- if ( staffReportReason !== undefined ) {
890+ if ( staffReportReason !== undefined && staffReportReason . length > 0 ) {
885891 await createReportMessage ( {
886892 instance,
887893 reportId,
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ type PUTAssignedUserBodyType = Static<typeof PUTAssignedUserBody>;
8282const CloseReportBody = Type . Object ( {
8383 status : Type . Enum ( ReportCloseStatusEnum ) ,
8484 message_to_reporting_user : Type . String ( ) ,
85- staff_report_reason : Type . String ( ) ,
85+ staff_report_reason : Type . Optional ( Type . String ( ) ) ,
8686} ) ;
8787
8888type CloseReportBodyType = Static < typeof CloseReportBody > ;
You can’t perform that action at this time.
0 commit comments