added point rating computation access
This commit is contained in:
42
src/main/java/com/poststats/golf/rs/api/CourseAdminApi.java
Normal file
42
src/main/java/com/poststats/golf/rs/api/CourseAdminApi.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.poststats.golf.rs.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import jakarta.ws.rs.PUT;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.Produces;
|
||||
|
||||
/**
|
||||
* @author brian.long@poststats.com
|
||||
*/
|
||||
@Path("/golf/course/{courseId:[0-9]+}")
|
||||
@Tag(name = "Course API")
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "Success"),
|
||||
@ApiResponse(responseCode = "401", description = "Not authenticated"),
|
||||
@ApiResponse(responseCode = "403", description = "Authenticated, but not permitted"),
|
||||
@ApiResponse(responseCode = "404", description = "A golf course with the specified ID could not be found")
|
||||
})
|
||||
public interface CourseAdminApi {
|
||||
|
||||
@PUT
|
||||
@Path("/pointIndex")
|
||||
@Produces(Constants.V1_JSON)
|
||||
@RolesAllowed(Constants.ADMIN_ROLE)
|
||||
@SecurityRequirement(name = "basic")
|
||||
@Operation(
|
||||
summary = "Intializes a golf course point rating",
|
||||
description = "Computes the point rating/adjustment for a single golf course and stores the result in the database. The result is a count of updated records."
|
||||
)
|
||||
byte initGolfCoursePointRatings(
|
||||
@Parameter(description = "A golf course ID") @NotNull @Positive @PathParam("courseId") int courseId);
|
||||
|
||||
}
|
70
src/main/java/com/poststats/golf/rs/api/CoursesAdminApi.java
Normal file
70
src/main/java/com/poststats/golf/rs/api/CoursesAdminApi.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package com.poststats.golf.rs.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import jakarta.ws.rs.PUT;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.Produces;
|
||||
|
||||
/**
|
||||
* @author brian.long@poststats.com
|
||||
*/
|
||||
@Path("/golf/courses")
|
||||
@Tag(name = "Course API")
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "Success"),
|
||||
@ApiResponse(responseCode = "401", description = "Not authenticated"),
|
||||
@ApiResponse(responseCode = "403", description = "Authenticated, but not permitted"),
|
||||
})
|
||||
public interface CoursesAdminApi {
|
||||
|
||||
@PUT
|
||||
@Path("/etrating/{etratingId:[0-9]+}/pointIndex")
|
||||
@Produces(Constants.V1_JSON)
|
||||
@RolesAllowed(Constants.ADMIN_ROLE)
|
||||
@SecurityRequirement(name = "basic")
|
||||
@Operation(
|
||||
summary = "Intializes a golf course eighteen/tee point rating",
|
||||
description = "Computes the point rating/adjustment for a single golf course eighteen/tee rating and stores the result in the database. The result is the computed point rating."
|
||||
)
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "404", description = "Eighteen/tee rating not found"),
|
||||
})
|
||||
byte initGolfCourseEighteenTeeRatingPointRating(@Parameter(description = "A golf course eighteen/tee rating ID")
|
||||
@NotNull @Positive @PathParam("etratingId") long etratingId);
|
||||
|
||||
@PUT
|
||||
@Path("/ntrating/{ntratingId:[0-9]+}/pointIndex")
|
||||
@Produces(Constants.V1_JSON)
|
||||
@RolesAllowed(Constants.ADMIN_ROLE)
|
||||
@SecurityRequirement(name = "basic")
|
||||
@Operation(
|
||||
summary = "Intializes a golf course nine/tee point rating",
|
||||
description = "Computes the point rating/adjustment for a single golf course nine/tee rating and stores the result in the database. The result is the computed point rating."
|
||||
)
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "404", description = "Nine/tee rating not found"),
|
||||
})
|
||||
byte initGolfCourseNineTeeRatingPointRating(@Parameter(description = "A golf course nine/tee rating ID")
|
||||
@NotNull @Positive @PathParam("ntratingId") long ntratingId);
|
||||
|
||||
@PUT
|
||||
@Path("/pointIndex")
|
||||
@Produces(Constants.V1_JSON)
|
||||
@RolesAllowed(Constants.ADMIN_ROLE)
|
||||
@SecurityRequirement(name = "basic")
|
||||
@Operation(
|
||||
summary = "Intializes golf course point ratings",
|
||||
description = "Computes the point rating/adjustment for all golf courses and stores the result in the database. The result is a count of updated records."
|
||||
)
|
||||
long initGolfCoursePointRatings();
|
||||
|
||||
}
|
Reference in New Issue
Block a user