Skip to content

Commit

Permalink
feat(db): Create a db table to store preferred review tags
Browse files Browse the repository at this point in the history
  • Loading branch information
shivam-sharma7 committed Sep 11, 2024
1 parent 9d0dd0d commit 9b23ed6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
12 changes: 11 additions & 1 deletion server/db/schema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sql } from 'drizzle-orm';
import { boolean, integer, pgTable, text, timestamp, uuid, varchar } from 'drizzle-orm/pg-core';
import { boolean, integer, pgTable, text, timestamp, uuid, varchar, smallint, serial } from 'drizzle-orm/pg-core';

const defaultUuidPkField = () =>
uuid('id')
Expand Down Expand Up @@ -73,6 +73,16 @@ export type PostingApplication = typeof postingApplicantsTable.$inferSelect;

//---------------**************----------------

export const reviewTagsTable = pgTable('review_tags', {
id: serial('id').primaryKey(),
title: varchar('title', { length: 8 }).notNull(),
parent: smallint('parent').notNull(),
});

export type ReviewTag = typeof reviewTagsTable.$inferSelect;

//---------------**************----------------

export const hooksTable = pgTable('hooks', {
id: defaultUuidPkField(),
title: varchar('title', { length: 40 }).notNull(),
Expand Down
9 changes: 9 additions & 0 deletions shared/schemas/review-tags.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { z } from 'zod';

export const reviewTagsSchema = z.object({
id: z.number().int().positive().optional(),
title: z.string().max(8),
parent: z.number().int().min(0).max(4),
});

export type ReviewTag = z.infer<typeof reviewTagsSchema>;

0 comments on commit 9b23ed6

Please sign in to comment.