This commit is contained in:
17
src/db/schema/strikeReason.ts
Normal file
17
src/db/schema/strikeReason.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { int, mysqlTable, tinyint, varchar } from 'drizzle-orm/mysql-core';
|
||||
import type { MySql2Database } from 'drizzle-orm/mysql2';
|
||||
import { asc } from 'drizzle-orm';
|
||||
|
||||
type Database = MySql2Database<{ strikeReason: typeof strikeReason }>;
|
||||
|
||||
export const strikeReason = mysqlTable('strike_reason', {
|
||||
id: int('id').primaryKey().autoincrement(),
|
||||
name: varchar('name', { length: 255 }).notNull(),
|
||||
weight: tinyint('weight').notNull()
|
||||
});
|
||||
|
||||
export type GetStrikeReasonsReq = {};
|
||||
|
||||
export async function getStrikeReasons(db: Database, _values: GetStrikeReasonsReq) {
|
||||
return db.select().from(strikeReason).orderBy(asc(strikeReason.weight));
|
||||
}
|
Reference in New Issue
Block a user