Skip to content

Commit 5ab5e71

Browse files
committed
Refactor subject page ID path variables
1 parent 0a2b0c1 commit 5ab5e71

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

frontpage-api/src/main/scala/no/ndla/frontpageapi/controller/SubjectPageController.scala

+3-4
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ trait SubjectPageController {
3030
class SubjectPageController extends TapirController {
3131
override val serviceName: String = "subjectpage"
3232
override val prefix: EndpointInput[Unit] = "frontpage-api" / "v1" / serviceName
33-
private val pathSubjectPageId =
34-
path[Long]("subject_page_id").description("Id of the subject page that is to be fetched")
33+
private val pathSubjectPageId = path[Long]("subjectpage-id").description("The subjectpage id")
3534
private val pathLanguage = path[String]("language").description("The ISO 639-1 language code describing language.")
3635

3736
def getAllSubjectPages: ServerEndpoint[Any, Eff] = endpoint.get
@@ -48,7 +47,7 @@ trait SubjectPageController {
4847

4948
def getSingleSubjectPage: ServerEndpoint[Any, Eff] = endpoint.get
5049
.summary("Get data to display on a subject page")
51-
.in(path[Long]("subjectpage-id").description("The subjectpage id"))
50+
.in(pathSubjectPageId)
5251
.in(query[String]("language").default(props.DefaultLanguage))
5352
.in(query[Boolean]("fallback").default(false))
5453
.out(jsonBody[SubjectPageDTO])
@@ -92,7 +91,7 @@ trait SubjectPageController {
9291
def updateSubjectPage: ServerEndpoint[Any, Eff] = endpoint.patch
9392
.summary("Update subject page")
9493
.in(jsonBody[UpdatedSubjectPageDTO])
95-
.in(path[Long]("subjectpage-id").description("The subjectpage id"))
94+
.in(pathSubjectPageId)
9695
.in(query[String]("language").default(props.DefaultLanguage))
9796
.in(query[Boolean]("fallback").default(false))
9897
.out(jsonBody[SubjectPageDTO])

0 commit comments

Comments
 (0)