// curl -u admin:password -X POST 'http://localhost:9080/gui/registrations/auto-mark-as-paid' @POST @Path("/auto-mark-as-paid") public Response postAutoMarkAsPaid(@Context HttpServletRequest httpRequest) { authService.guardAuthenticatedUser(httpRequest); int i = 0; try { i = sub(); } catch (Exception e) { e.printStackTrace(); } return Response.ok( ArgoUtils.format( Result.success(String.format("%s registreringar markerade som betalda.", i)))) .build(); }
@POST @Path("/mark-as-complete") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response postMarkAsComplete(@Context HttpServletRequest httpRequest, String body) throws Exception { authService.guardAuthenticatedUser(httpRequest); int i = 0; for (UUID uuid : registrationListRequest(body)) { markAsCompleteService.markAsComplete(uuid); i++; } return Response.ok( ArgoUtils.format(Result.success(String.format("Flyttade %s registreringar.", i)))) .build(); }
@POST @Path("/send-invoices") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response postSendInvoices(@Context HttpServletRequest request, String body) throws Exception { authService.guardAuthenticatedUser(request); int invoicesSent = 0; for (UUID uuid : registrationListRequest(body)) { sendInvoiceService.sendInvoice(uuid); invoicesSent++; } return Response.ok( ArgoUtils.format(Result.success(String.format("Skickade %s fakturor.", invoicesSent)))) .build(); }
@POST @Path("/dismiss-registrations") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response postDismissRegistrations(@Context HttpServletRequest httpRequest, String body) throws Exception { authService.guardAuthenticatedUser(httpRequest); int invoicesDismissed = 0; for (UUID uuid : registrationListRequest(body)) { dismissRegistrationService.dismissRegistration(uuid); invoicesDismissed++; } return Response.ok( ArgoUtils.format( Result.success(String.format("Avfärdade %s registreringar.", invoicesDismissed)))) .build(); }
@POST @Path("/mark-as-printed") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response markAsPrinted(@Context HttpServletRequest request, String body) throws Exception { authService.guardAuthenticatedUser(request); int i = 0; for (UUID uuid : registrationListRequest(body)) { try (Connection c = dataSource.getConnection()) { registrationsSqlMapper.replacePrintedNametag(c, uuid, Option.some(new PrintedNametag())); } i++; } return Response.ok( ArgoUtils.format( Result.success(String.format("Markerade %s namnbrickor som utskrivna.", i)))) .build(); }