Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1186 feat storage request: schema #1208

Draft
wants to merge 28 commits into
base: dev
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
df60949
feat: apiSto endpoint
shiro-el Nov 13, 2024
34bad4a
fix: apiSto001 phoneNum
shiro-el Nov 13, 2024
bc73144
feat: storage table schema
shiro-el Nov 13, 2024
4fa1bcb
feat: api storage
shiro-el Nov 13, 2024
1b376b6
feat: storage application form
shiro-el Nov 13, 2024
d368e41
feat: storage/application api
shiro-el Nov 16, 2024
dff5383
feat: apiSto contracts
shiro-el Nov 16, 2024
e3801b0
feat: add storage module
shiro-el Nov 24, 2024
5f1a3db
feat: /storage
shiro-el Nov 24, 2024
03f0af4
Merge branch 'dev' into 1186-feat-storage-request
shiro-el Nov 24, 2024
a3a77ce
fix: fileId type to string
shiro-el Nov 26, 2024
9f517d4
fix: fileId type to string
shiro-el Nov 26, 2024
b99be21
fix: handleAddActivityDescription
shiro-el Nov 26, 2024
ab8cf0b
fix: sto schema
shiro-el Nov 27, 2024
221d5f5
fix: apiSto
shiro-el Nov 29, 2024
8da59c0
feat: /executive/storage, /manage-club/storage
shiro-el Nov 29, 2024
0e1d570
fix: sto interface
shiro-el Nov 29, 2024
458ca3d
fix: apiSto
shiro-el Nov 29, 2024
bc23634
Merge branch 'dev' into 1186-feat-storage-request
shiro-el Nov 29, 2024
5594c97
fix: import errors
shiro-el Nov 29, 2024
28cc9d4
fix: apiSto
shiro-el Nov 29, 2024
ae9e258
fix: storage interface
shiro-el Nov 29, 2024
2c53e80
feat: storage
shiro-el Dec 1, 2024
df597b8
feat: sto interface
shiro-el Dec 1, 2024
7e0377d
fix: apiSto
shiro-el Dec 1, 2024
aa1a6e1
fix: apiSto008, 009, 013
shiro-el Dec 1, 2024
813cf8e
fix: apiSto008, 009, 013 interface
shiro-el Dec 1, 2024
96d0442
fix: manage-club/storage, executive/storage
shiro-el Dec 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: storage table schema
shiro-el committed Nov 13, 2024
commit bc73144413eace9deb736e3d5dcbb299107d519f
88 changes: 88 additions & 0 deletions packages/api/src/drizzle/schema/storage.schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import {
boolean,
datetime,
int,
mysqlTable,
text,
timestamp,
varchar,
} from "drizzle-orm/mysql-core";

import { Club } from "./club.schema";
import { File } from "./file.schema";
import { Executive, Student } from "./user.schema";

// StorageApplicaiton table
export const StorageApplicaiton = mysqlTable("storage_application", {
id: int("id").autoincrement().primaryKey(),
clubId: int("club_id")
.notNull()
.references(() => Club.id),
studentId: int("student_id")
.notNull()
.references(() => Student.id),
studentPhoneNumber: varchar("student_phone_number", { length: 30 }).notNull(),
numberOfBoxes: int("number_of_boxes").notNull(),
desiredPickUpDate: datetime("desired_pick_up_date").notNull(),
PickUpDate: datetime("pick_up_date"),
desiredStartDate: datetime("desired_start_date").notNull(),
desiredEndDate: datetime("desired_end_date").notNull(),
status: varchar("status", { length: 30 }).notNull(),
isPickedUp: boolean("is_picked_up").notNull(),
contractId: int("contract_id")
// eslint-disable-next-line @typescript-eslint/no-use-before-define
.references(() => StorageContract.id),
note: text("note"),
createdAt: timestamp("created_at").defaultNow(),
updatedAt: timestamp("updated_at").defaultNow(),
deletedAt: timestamp("deleted_at"),
});

// StorageContract table
export const StorageContract = mysqlTable("storage_contract", {
id: int("id").autoincrement().primaryKey(),
endDate: datetime("end_date"),
numberOfBoxes: int("number_of_boxes").notNull(),
numberOfNonStandardItems: int("number_of_non_standard_items").notNull(),
charge: int("charge").notNull(),
zone: varchar("zone", { length: 255 }),
studentId: int("student_id")
.notNull()
.references(() => Student.id),
executiveId: int("executive_id")
.notNull()
.references(() => Executive.id),
applicationId: int("application_id")
.notNull()
.references(() => StorageApplicaiton.id),
note: text("note"),
createdAt: timestamp("created_at").defaultNow(),
updatedAt: timestamp("updated_at").defaultNow(),
deletedAt: timestamp("deleted_at"),
});

// StorageBox table
export const StorageBox = mysqlTable("Storage_box", {
id: int("id").autoincrement().primaryKey(),
contractId: int("contract_id")
.notNull()
.references(() => StorageContract.id),
note: text("note"),
createdAt: timestamp("created_at").defaultNow(),
updatedAt: timestamp("updated_at").defaultNow(),
deletedAt: timestamp("deleted_at"),
});

// StorageNonStandard table
export const StorageNonStandard = mysqlTable("Storage_non_standard", {
id: int("id").autoincrement().primaryKey(),
applicationId: int("application_id")
.notNull()
.references(() => StorageApplicaiton.id),
name: varchar("name", { length: 30 }),
fileId: int("file_id").references(() => File.id),
note: text("note"),
createdAt: timestamp("created_at").defaultNow(),
updatedAt: timestamp("updated_at").defaultNow(),
deletedAt: timestamp("deleted_at"),
});