Skip to content

Commit

Permalink
Get and update proposal cycle title
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanEngland committed Apr 24, 2024
1 parent b189f9d commit d0d6e16
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,36 @@ public ProposalCycle createProposalCycle(ProposalCycle cycle) {
return persistObject(cycle);
}

///********* TITLE **********

@GET
@Path("{cycleCode}/title")
@Operation(summary = "Get the title for a given proposal cycle")
public Response getProposalCycleTitle(@PathParam("cycleCode") Long cycleCode)
{
ProposalCycle fullCycle = findObject(ProposalCycle.class, cycleCode);

return responseWrapper(fullCycle.getTitle(), 200);
}

@PUT
@Path("{cycleCode}/title")
@Operation(summary = "change the title of the given proposal cycle")
@Consumes(MediaType.APPLICATION_JSON)
@Transactional(rollbackOn = {WebApplicationException.class})
public Response replaceCycleTitle(
@PathParam("cycleCode") Long cycleCode,
String replacementTitle
)
throws WebApplicationException
{
ProposalCycle cycle = findObject(ProposalCycle.class, cycleCode);

cycle.setTitle(replacementTitle);

return responseWrapper(cycle.getTitle(), 200);
}


//********* DATES **********

Expand Down

0 comments on commit d0d6e16

Please sign in to comment.