Add validation for status page resources

This commit is contained in:
Simon Larsen 2023-12-16 21:14:07 +00:00
parent 14c6bdb3b4
commit c520d09351
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE

View File

@ -1231,6 +1231,11 @@ export default class StatusPageAPI extends BaseAPI<
statusPageSubscriber.statusPageId = objectId;
statusPageSubscriber.projectId = statusPage.projectId!;
if(req.body.data['statusPageResources'].length === 0){
throw new BadDataException('At least one resource is required to subscribe to this status page.');
}
if(req.body.data['statusPageResources']){
statusPageSubscriber.statusPageResources = req.body.data['statusPageResources'] as Array<StatusPageResource>;
}