feat: Moves database dependency directory.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user