Skip to content

Commit

Permalink
fix date check on release endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Oct 4, 2024
1 parent 6f4bd5e commit 888b0a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 1 addition & 4 deletions apps/webservice/src/app/api/v1/releases/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ import { Permission } from "@ctrlplane/validators/auth";
import { getUser } from "~/app/api/v1/auth";

const bodySchema = createRelease.and(
z.object({
metadata: z.record(z.string()).optional(),
createdAt: z.string().transform((s) => new Date(s)),
}),
z.object({ metadata: z.record(z.string()).optional() }),
);

export const POST = async (req: NextRequest) => {
Expand Down
4 changes: 4 additions & 0 deletions packages/db/src/schema/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export const createRelease = createInsertSchema(release, {
version: z.string().min(1),
name: z.string().min(1),
config: z.record(z.any()),
createdAt: z
.string()
.transform((s) => new Date(s))
.optional(),
})
.omit({ id: true })
.extend({
Expand Down

0 comments on commit 888b0a3

Please sign in to comment.