1313
1414import edu .tamu .app .model .Service ;
1515import edu .tamu .app .model .repo .ServiceRepo ;
16+ import edu .tamu .app .service .SystemMonitorService ;
1617import edu .tamu .framework .aspect .annotation .ApiMapping ;
1718import edu .tamu .framework .aspect .annotation .ApiValidatedModel ;
1819import edu .tamu .framework .aspect .annotation .ApiValidation ;
@@ -29,6 +30,9 @@ public class ServiceController {
2930
3031 @ Autowired
3132 private ServiceRepo serviceRepo ;
33+
34+ @ Autowired
35+ private SystemMonitorService systemMonitorService ;
3236
3337 @ ApiMapping ("/all" )
3438 @ Auth (role ="ROLE_STAFF" )
@@ -53,8 +57,9 @@ public ApiResponse getService(@ApiVariable Long id) {
5357 @ Auth (role = "ROLE_SERVICE_MANAGER" )
5458 @ ApiValidation (business = { @ ApiValidation .Business (value = CREATE ), @ ApiValidation .Business (value = EXISTS ) })
5559 public ApiResponse createService (@ ApiValidatedModel Service service ) {
56- service = serviceRepo .create (service .getName (), service .getStatus (), service .getIsAuto (), service .getIsPublic (), service .getOnShortList (), service .getServiceUrl ());
60+ service = serviceRepo .create (service .getName (), service .getStatus (), service .getIsAuto (), service .getIsPublic (), service .getOnShortList (), service .getServiceUrl (), service . getDescription () );
5761 simpMessagingTemplate .convertAndSend ("/channel/service" , new ApiResponse (SUCCESS , serviceRepo .findAll ()));
62+ systemMonitorService .updateAll ();
5863 return new ApiResponse (SUCCESS , service );
5964 }
6065
@@ -64,6 +69,7 @@ public ApiResponse createService(@ApiValidatedModel Service service) {
6469 public ApiResponse updateService (@ ApiValidatedModel Service service ) {
6570 service = serviceRepo .save (service );
6671 simpMessagingTemplate .convertAndSend ("/channel/service/" + service .getId (), new ApiResponse (SUCCESS , service ));
72+ systemMonitorService .updateAll ();
6773 return new ApiResponse (SUCCESS , service );
6874 }
6975
0 commit comments