feat: Moves database dependency directory.

This commit is contained in:
2025-01-11 00:26:08 -05:00
parent 9994644d21
commit 0e31d2c30c
11 changed files with 20 additions and 18 deletions

View File

@@ -25,9 +25,9 @@ struct EmployeeApiController: RouteCollection {
@Sendable
func create(req: Request) async throws -> Employee.DTO {
try Employee.Create.validate(content: req)
let create = try req.content.decode(Employee.Create.self)
return try await employees.create(create)
try await employees.create(
req.ensureValidContent(Employee.Create.self)
)
}
@Sendable
@@ -42,11 +42,10 @@ struct EmployeeApiController: RouteCollection {
@Sendable
func update(req: Request) async throws -> Employee.DTO {
try Employee.Update.validate(content: req)
guard let employeeID = req.parameters.get("employeeID", as: Employee.IDValue.self) else {
throw Abort(.badRequest, reason: "Employee id value not provided")
}
let updates = try req.content.decode(Employee.Update.self)
let updates = try req.ensureValidContent(Employee.Update.self)
return try await employees.update(employeeID, updates)
}