Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ REDIS_MAX_ACTIVE_CON="20"
DEFAULT_USER_NAME="Test Test"
DEFAULT_USER_EMAIL="[email protected]"
DEFAULT_USER_PASSWORD="password"

# Logging
REQUEST_LOG_HEADERS="true"
RESPONSE_LOG_HEADERS="true"
REQUEST_LOG_BODY_PREVIEW="true"
25 changes: 25 additions & 0 deletions Sources/Grodt/Endpoints/Routes/ski/account/AccountRoute.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Vapor
import Fluent

class AccountRoute: RouteCollection {
private let service: AccountService

init(service: AccountService) {
self.service = service
}

func boot(routes: Vapor.RoutesBuilder) throws {
let account = routes.grouped("account")
account.group("me") { me in
me.get(use: userInfo)
}
}

func userInfo(req: Request) async throws -> UserInfoDTO {
let userID = try req.requireUserID()

return try await self.service.userInfo(for: userID)
}
}

extension UserInfoDTO: Content { }
4 changes: 4 additions & 0 deletions Sources/Grodt/Endpoints/Routes/ski/routes+ski.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,9 @@ func registerSkiRoutes(_ app: Application, _ container: AppContainer) throws {
try protected.register(collection: InvestmentRoute(
serivce: container.investmentService)
)

try protected.register(collection: AccountRoute(
service: container.accountService)
)
}
}