feat: Updates styles in css and views.

This commit is contained in:
2025-01-01 12:20:55 -05:00
parent 26191a15c1
commit 99d77c0808
4 changed files with 147 additions and 45 deletions

View File

@@ -15,6 +15,7 @@ struct ApiController: RouteCollection {
proCon.get(use: prosAndConsIndex(req:))
proCon.post(use: createProCon(req:))
proCon.delete(":id", use: deleteProCon(req:))
utils.post("check-words", use: checkWords(req:))
}
@@ -44,6 +45,19 @@ struct ApiController: RouteCollection {
return proCon
}
@Sendable
func deleteProCon(req: Request) async throws -> HTTPStatus {
guard let idString = req.parameters.get("id"),
let id = UUID(uuidString: idString)
else {
throw Abort(.badRequest)
}
try await ProCon.query(on: req.db)
.filter(\.$id == id)
.delete()
return .ok
}
@Sendable
func checkWords(req: Request) async throws -> HTTPStatus {
let input = try req.content.decode(CheckWords.self)