Skip to content

Commit

Permalink
chore: resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
sparcscasio committed Nov 23, 2024
2 parents ab934c9 + b8cf236 commit e8f53d5
Show file tree
Hide file tree
Showing 70 changed files with 13,189 additions and 506 deletions.
6,365 changes: 6,365 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@
"node": "^20.9.0",
"pnpm": "^8.0.0"
},
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"dependencies": {
"uuid": "^11.0.3"
}
}
3 changes: 1 addition & 2 deletions packages/api/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import { Module } from "@nestjs/common";
import { AppController } from "./app.controller";
import { AppService } from "./app.service";
import { DrizzleModule } from "./drizzle/drizzle.module";
import { UserModule } from "./feature/user/user.module";

@Module({
imports: [DrizzleModule, UserModule],
imports: [DrizzleModule],
controllers: [AppController],
providers: [AppService],
})
Expand Down
27 changes: 0 additions & 27 deletions packages/api/src/common/repository/user.repository.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/api/src/drizzle/drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { env } from "src/env";
export default {
driver: "mysql2",
out: "./src/drizzle/migration",
schema: "./src/drizzle/schema/*",
schema: "./src/drizzle/schema/*.schema.ts",
dbCredentials: {
uri: env.DATABASE_URL,
},
Expand Down
81 changes: 81 additions & 0 deletions packages/api/src/drizzle/schema/enum.schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { InferSelectModel } from "drizzle-orm";
import { int, varchar, timestamp, mysqlTable } from "drizzle-orm/mysql-core";

export const OrganizationTypeEnum = mysqlTable("org_typ_e", {
id: int("id").autoincrement().primaryKey().notNull(),
name: varchar("name", { length: 30 }).notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
});

export const OrganizationPresidentTypeEnum = mysqlTable("org_pre_typ_e", {
id: int("id").autoincrement().primaryKey().notNull(),
name: varchar("name", { length: 30 }).notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
});

export const BudgetDomainEnum = mysqlTable("bud_dom_e", {
id: int("id").autoincrement().primaryKey().notNull(),
name: varchar("name", { length: 30 }).notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
});

export const BudgetDivisionIncomeEnum = mysqlTable("bud_div_inc_e", {
id: int("id").autoincrement().primaryKey().notNull(),
name: varchar("name", { length: 30 }).notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
});

export const BudgetDivisionExpenseEnum = mysqlTable("bud_div_exp_e", {
id: int("id").autoincrement().primaryKey().notNull(),
name: varchar("name", { length: 30 }).notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
});

export const BudgetClassExpenseEnum = mysqlTable("bud_cla_exp_e", {
id: int("id").autoincrement().primaryKey().notNull(),
name: varchar("name", { length: 30 }).notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
});

export const TransactionTypeEnum = mysqlTable("tra_typ_e", {
id: int("id").autoincrement().primaryKey().notNull(),
name: varchar("name", { length: 30 }).notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
});

export const ReportFileTypeEnum = mysqlTable("rep_fil_typ_e", {
id: int("id").autoincrement().primaryKey().notNull(),
name: varchar("name", { length: 30 }).notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
});

export const AssistantPermissionEnum = mysqlTable("ass_per_e", {
id: int("id").autoincrement().primaryKey().notNull(),
name: varchar("name", { length: 30 }).notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
});

export type OrganizationTypeEnumT = InferSelectModel<
typeof OrganizationTypeEnum
>;
export type OrganizationPresidentTypeEnumT = InferSelectModel<
typeof OrganizationPresidentTypeEnum
>;
37 changes: 37 additions & 0 deletions packages/api/src/drizzle/schema/file.schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {
int,
varchar,
datetime,
timestamp,
mysqlTable,
foreignKey,
} from "drizzle-orm/mysql-core";
import { v4 as uuidv4 } from "uuid";
import { User } from "./user.schema";

function createUuid(): string {
return uuidv4();
}

export const File = mysqlTable(
"file",
{
id: int("id").autoincrement().primaryKey().notNull(),
uuid: varchar("uuid", { length: 128 })
.$defaultFn(() => createUuid())
.unique(),
name: varchar("name", { length: 255 }).notNull(),
extension: varchar("extension", { length: 255 }).notNull(),
size: int("size").notNull(),
userId: int("user_id").notNull(),
signedAt: datetime("signed_at").notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
deletedAt: timestamp("deleted_at"),
},
table => ({
userIdFk: foreignKey({
columns: [table.userId],
foreignColumns: [User.id],
}),
}),
);
7 changes: 7 additions & 0 deletions packages/api/src/drizzle/schema/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export * from "./enum.schema";
export * from "./user.schema";
export * from "./semester.schema";
export * from "./organization.schema";
export * from "./meeting.schema";
export * from "./proposal.schema";
export * from "./file.schema";
41 changes: 41 additions & 0 deletions packages/api/src/drizzle/schema/meeting.schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {
int,
varchar,
text,
date,
timestamp,
boolean,
mysqlTable,
foreignKey,
} from "drizzle-orm/mysql-core";

export const Meeting = mysqlTable("meeting", {
id: int("id").autoincrement().primaryKey().notNull(),
startTerm: date("start_term").notNull(),
endTerm: date("end_term"),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
name: varchar("name", { length: 30 }).notNull(),
detail: text("detail"),
});

export const Agenda = mysqlTable(
"agenda",
{
id: int("id").autoincrement().primaryKey().notNull(),
meetingId: int("meeting_id").notNull(),
accepted: boolean("accepted"),
createdAt: timestamp("created_at").defaultNow().notNull(),
submittedAt: timestamp("submitted_at"),
postedAt: timestamp("posted_at"),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
},
table => ({
meetingIdFk: foreignKey({
columns: [table.meetingId],
foreignColumns: [Meeting.id],
}),
}),
);
Loading

0 comments on commit e8f53d5

Please sign in to comment.