Skip to content

Commit

Permalink
ID-807 stubbing out Routes for new ToS routes (#1213)
Browse files Browse the repository at this point in the history
* ID-807 stubbing out Routes for new ToS routes

* ID-807 stubbing out Routes for new ToS routes

* ID-807 stubbing out Routes for new ToS routes

---------

Co-authored-by: Greg Polumbo <>
  • Loading branch information
gpolumbo-broad authored Oct 23, 2023
1 parent 5a91c3f commit a321af9
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 2 deletions.
2 changes: 1 addition & 1 deletion project/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object Settings {
"-language:existentials", // Existential types (besides wildcard types) can be written and inferred
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
"-Xfatal-warnings", // Fail the compilation if there are any warnings.
"-Wconf:cat=deprecation:ws,any:e", // Fail the compilation if there are any warnings, except for deprecation warnings.
"-Xlint:adapted-args", // Warn if an argument list is modified to match the receiver.
"-Xlint:constant", // Evaluation of a constant arithmetic expression results in an error.
"-Xlint:delayedinit-select", // Selecting member of DelayedInit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ abstract class SamRoutes(
oidcConfig.swaggerRoutes("swagger/api-docs.yaml") ~
oidcConfig.oauth2Routes ~
statusRoutes ~
oldTermsOfServiceRoutes ~
termsOfServiceRoutes ~
withExecutionContext(ExecutionContext.global) {
withSamRequestContext { samRequestContext =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.broadinstitute.dsde.workbench.sam.api

import akka.http.scaladsl.model.StatusCodes
import akka.http.scaladsl.server
import akka.http.scaladsl.server.Directives._
import org.broadinstitute.dsde.workbench.sam.service.TosService
Expand All @@ -10,7 +11,8 @@ trait TermsOfServiceRoutes {
val tosService: TosService
implicit val executionContext: ExecutionContext

def termsOfServiceRoutes: server.Route =
@deprecated("Being replaced by REST-ful termsOfService routes")
def oldTermsOfServiceRoutes: server.Route =
pathPrefix("tos") {
path("text") {
pathEndOrSingleSlash {
Expand All @@ -29,4 +31,67 @@ trait TermsOfServiceRoutes {
}
}
}

def termsOfServiceRoutes: server.Route =
pathPrefix("termsOfService") {
pathPrefix("v1") { // api/termsOfService/v1
pathEndOrSingleSlash {
get {
complete(StatusCodes.NotImplemented)
}
} ~
pathPrefix("docs") { // api/termsOfService/v1/docs
pathEndOrSingleSlash {
get {
complete(StatusCodes.NotImplemented)
}
} ~
pathPrefix("redirect") { // api/termsOfService/v1/docs/redirect
pathEndOrSingleSlash {
get {
complete(StatusCodes.NotImplemented)
}
}
}
} ~
pathPrefix("user") { // api/termsOfService/v1/user
pathPrefix("self") { // api/termsOfService/v1/user/self
pathEndOrSingleSlash {
get {
complete(StatusCodes.NotImplemented)
}
} ~
pathPrefix("accept") { // api/termsOfService/v1/user/accept
pathEndOrSingleSlash {
put {
complete(StatusCodes.NotImplemented)
}
}
} ~
pathPrefix("reject") { // api/termsOfService/v1/user/reject
pathEndOrSingleSlash {
put {
complete(StatusCodes.NotImplemented)
}
}
}
} ~
// The {user_id} route must be last otherwise it will try to parse the other routes incorrectly as user id's
pathPrefix(Segment) { userId => // api/termsOfService/v1/user/{userId}
pathEndOrSingleSlash {
get {
complete(StatusCodes.NotImplemented)
}
} ~
pathPrefix("history") { // api/termsOfService/v1/user/{userId}/history
pathEndOrSingleSlash {
get {
complete(StatusCodes.NotImplemented)
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ abstract class MockSamRoutes(
oidcConfig.swaggerRoutes("swagger/api-docs.yaml") ~
oidcConfig.oauth2Routes ~
statusRoutes ~
oldTermsOfServiceRoutes ~
termsOfServiceRoutes ~
withExecutionContext(ExecutionContext.global) {
withSamRequestContext { samRequestContext =>
Expand Down

0 comments on commit a321af9

Please sign in to comment.