Skip to content

Commit

Permalink
Merge branch 'dev' into 47-impl-semester-doc-select-component
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaeyeonAhn committed Dec 26, 2024
2 parents b19f2d0 + 64823ab commit 929c7cd
Show file tree
Hide file tree
Showing 59 changed files with 11,590 additions and 7,061 deletions.
4 changes: 2 additions & 2 deletions .docker/dockerfile/api.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

# Base image with node + pnpm
# TODO: bump pnpm to 9 (must change 'engine' field in package.json)
FROM node:20-slim AS base
FROM node:22-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN corepack prepare pnpm@8.15.8 --activate
RUN corepack prepare pnpm@9.14.4 --activate
WORKDIR /app

# Build to output .next build directory
Expand Down
4 changes: 2 additions & 2 deletions .docker/dockerfile/web.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

# Base image with node + pnpm
# TODO: bump pnpm to 9 (must change 'engine' field in package.json)
FROM node:20-slim AS base
FROM node:22-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN corepack prepare pnpm@8.15.8 --activate
RUN corepack prepare pnpm@9.14.4 --activate
WORKDIR /app

# Build to output .next build directory
Expand Down
4 changes: 2 additions & 2 deletions .docker/dockerfile/web.bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

# Base image with node + pnpm
# TODO: bump pnpm to 9 (must change 'engine' field in package.json)
FROM node:20-slim AS base
FROM node:22-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN corepack prepare pnpm@8.15.8 --activate
RUN corepack prepare pnpm@9.14.4 --activate
WORKDIR /app

# Build to output .next build directory
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cd-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
jobs:
publish-docker-image:
name: "Build and Publish Latest Docker Image"
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

strategy:
fail-fast: true
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
deploy-production-image:
name: "Deploy Latest Staging Docker Image to Server"
needs: [publish-docker-image]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: "Image push via webhook"
uses: distributhor/workflow-webhook@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cd-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
jobs:
publish-docker-image:
name: "Build and Publish Latest Docker Image"
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

strategy:
fail-fast: true
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
deploy-production-image:
name: "Deploy Latest Staging Docker Image to Server"
needs: [publish-docker-image]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: "Image push via webhook"
uses: distributhor/workflow-webhook@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ on:
jobs:
lint-and-format:
name: Lint and Format
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

strategy:
matrix:
node-version: [20.x]
node-version: [22.12.0]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
pnpm-version: [8.x]
pnpm-version: [9.14.4]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.9.0
v22.12.0
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
"typescript": "^5.1.6"
},
"engines": {
"node": "^20.9.0",
"pnpm": "^8.0.0"
"node": "^22.12.0",
"pnpm": "^9.14.4"
},
"packageManager": "pnpm@8.15.8",
"packageManager": "pnpm@9.14.4",
"dependencies": {
"uuid": "^11.0.3"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@
"coverageDirectory": "../coverage",
"testEnvironment": "node"
},
"packageManager": "pnpm@8.15.8"
"packageManager": "pnpm@9.14.4"
}
14 changes: 14 additions & 0 deletions packages/api/src/drizzle/schema/enum.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ export const AgendaAcceptedStatusEnum = mysqlTable(
},
);

export const DocumentReviewStatusEnum = mysqlTable(
"document_review_status_enum",
{
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
>;
Expand All @@ -102,3 +113,6 @@ export type OrganizationPresidentTypeEnumT = InferSelectModel<
export type AgendaAcceptedStatusEnumT = InferSelectModel<
typeof AgendaAcceptedStatusEnum
>;
export type DocumentReviewStatusEnumT = InferSelectModel<
typeof DocumentReviewStatusEnum
>;
5 changes: 5 additions & 0 deletions packages/api/src/drizzle/schema/organization.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export const OperatingCommitteeMember = mysqlTable(
id: int("id").autoincrement().primaryKey().notNull(),
organizationId: int("organization_id").notNull(),
userId: int("user_id").notNull(),
semesterId: int("semester_id").notNull(),
role: varchar("role", { length: 30 }).notNull(),
legalBasis: varchar("legal_basis", { length: 30 }).notNull(),
createdAt: timestamp("created_at").defaultNow().notNull(),
Expand All @@ -115,6 +116,10 @@ export const OperatingCommitteeMember = mysqlTable(
columns: [table.userId],
foreignColumns: [User.id],
}),
semesterIdFk: foreignKey({
columns: [table.semesterId],
foreignColumns: [Semester.id],
}),
}),
);

Expand Down
132 changes: 121 additions & 11 deletions packages/api/src/drizzle/schema/proposal.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
BudgetDivisionIncomeEnum,
BudgetDivisionExpenseEnum,
BudgetClassExpenseEnum,
DocumentReviewStatusEnum,
} from "./enum.schema";

// ProjectProposal 테이블
Expand Down Expand Up @@ -51,17 +52,18 @@ export const ProjectProposalRevision = mysqlTable(
id: int("id").autoincrement().primaryKey().notNull(),
documentId: int("document_id").notNull(),
name: varchar("name", { length: 255 }).notNull(),
method: text("method").notNull(),
prepareStartTerm: datetime("prepare_start_term").notNull(),
prepareEndTerm: datetime("prepare_end_term").notNull(),
startTerm: datetime("start_term").notNull(),
endTerm: datetime("end_term").notNull(),
teamId: int("team_id").notNull(),
managerId: int("manager_id").notNull(),
purpose: text("purpose").notNull(),
target: text("target").notNull(),
detail: text("detail").notNull(),
method: text("method"),
prepareStartTerm: datetime("prepare_start_term"),
prepareEndTerm: datetime("prepare_end_term"),
startTerm: datetime("start_term"),
endTerm: datetime("end_term"),
teamId: int("team_id"),
managerId: int("manager_id"),
purpose: text("purpose"),
target: text("target"),
detail: text("detail"),
note: text("note"),
submittedAt: timestamp("submitted_at"),
agendaId: int("agenda_id"),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
Expand Down Expand Up @@ -198,13 +200,14 @@ export const BudgetProposalIncomeRevision = mysqlTable(
documentId: int("document_id").notNull(),
budgetDomainEnumId: int("budget_domain_enum_id"),
budgetDivisionIncomeEnumId: int("budget_division_income_enum_id"),
name: varchar("name", { length: 30 }),
name: varchar("name", { length: 30 }).notNull(),
amount: int("amount"),
detail: text("detail"),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
agendaId: int("agenda_id"),
submittedAt: timestamp("submitted_at"),
},
table => ({
documentIdFk: foreignKey({
Expand Down Expand Up @@ -272,6 +275,7 @@ export const BudgetProposalExpenseRevision = mysqlTable(
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
agendaId: int("agenda_id"),
submittedAt: timestamp("submitted_at"),
},
table => ({
documentIdFk: foreignKey({
Expand Down Expand Up @@ -307,6 +311,103 @@ export const BudgetProposalExpenseRevision = mysqlTable(
}),
);

// ProjectProposalDocumentReview 테이블
export const ProjectProposalDocumentReview = mysqlTable(
"project_proposal_document_review",
{
id: int("id").autoincrement().primaryKey().notNull(),
documentId: int("document_id").notNull(),
userId: int("user_id").notNull(),
documentReviewStatusEnumId: int("document_review_status_enum_id").notNull(),
detail: text("detail"),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
},
table => ({
documentIdFk: foreignKey({
columns: [table.documentId],
foreignColumns: [ProjectProposal.id],
name: "pro_pro_doc_rev_document_id_fk",
}),
userIdFk: foreignKey({
columns: [table.userId],
foreignColumns: [User.id],
name: "pro_pro_doc_rev_user_id_fk",
}),
documentReviewStatusEnumIdFk: foreignKey({
columns: [table.documentReviewStatusEnumId],
foreignColumns: [DocumentReviewStatusEnum.id],
name: "pro_pro_doc_rev_document_review_status_enum_id_fk",
}),
}),
);

// BudgetProposalIncomeDocumentReview 테이블
export const BudgetProposalIncomeDocumentReview = mysqlTable(
"budget_proposal_income_document_review",
{
id: int("id").autoincrement().primaryKey().notNull(),
documentId: int("document_id").notNull(),
userId: int("user_id").notNull(),
documentReviewStatusEnumId: int("document_review_status_enum_id").notNull(),
detail: text("detail"),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
},
table => ({
documentIdFk: foreignKey({
columns: [table.documentId],
foreignColumns: [BudgetProposalIncome.id],
name: "bud_pro_inc_doc_rev_document_id_fk",
}),
userIdFk: foreignKey({
columns: [table.userId],
foreignColumns: [User.id],
name: "bud_pro_inc_doc_rev_user_id_fk",
}),
documentReviewStatusEnumIdFk: foreignKey({
columns: [table.documentReviewStatusEnumId],
foreignColumns: [DocumentReviewStatusEnum.id],
name: "bud_pro_inc_doc_rev_document_review_status_enum_id_fk",
}),
}),
);

// BudgetProposalExpenseDocumentReview 테이블
export const BudgetProposalExpenseDocumentReview = mysqlTable(
"budget_proposal_expense_document_review",
{
id: int("id").autoincrement().primaryKey().notNull(),
documentId: int("document_id").notNull(),
userId: int("user_id").notNull(),
documentReviewStatusEnumId: int("document_review_status_enum_id").notNull(),
detail: text("detail"),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
deletedAt: timestamp("deleted_at"),
},
table => ({
documentIdFk: foreignKey({
columns: [table.documentId],
foreignColumns: [BudgetProposalExpense.id],
name: "bud_pro_exp_doc_rev_document_id_fk",
}),
userIdFk: foreignKey({
columns: [table.userId],
foreignColumns: [User.id],
name: "bud_pro_exp_doc_rev_user_id_fk",
}),
documentReviewStatusEnumIdFk: foreignKey({
columns: [table.documentReviewStatusEnumId],
foreignColumns: [DocumentReviewStatusEnum.id],
name: "bud_pro_exp_doc_rev_document_review_status_enum_id_fk",
}),
}),
);

// 타입 추론
export type ProjectProposalT = InferSelectModel<typeof ProjectProposal>;
export type ProjectProposalRevisionT = InferSelectModel<
typeof ProjectProposalRevision
Expand All @@ -330,3 +431,12 @@ export type BudgetProposalExpenseT = InferSelectModel<
export type BudgetProposalExpenseRevisionT = InferSelectModel<
typeof BudgetProposalExpenseRevision
>;
export type ProjectProposalDocumentReviewT = InferSelectModel<
typeof ProjectProposalDocumentReview
>;
export type BudgetProposalIncomeDocumentReviewT = InferSelectModel<
typeof BudgetProposalIncomeDocumentReview
>;
export type BudgetProposalExpenseDocumentReviewT = InferSelectModel<
typeof BudgetProposalExpenseDocumentReview
>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Controller } from "@nestjs/common";

import { ExampleService } from "../service/example.service";

@Controller()
export class ExampleController {
constructor(private readonly exampleService: ExampleService) {}
}
14 changes: 14 additions & 0 deletions packages/api/src/feature/_example/example.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Module } from "@nestjs/common";

import { DrizzleModule } from "src/drizzle/drizzle.module";
import { ExampleService } from "./service/example.service";
import { ExampleController } from "./controller/example.controller";
import { ExampleRepository } from "./repository/example.repository";

@Module({
imports: [DrizzleModule],
controllers: [ExampleController],
providers: [ExampleService, ExampleRepository],
exports: [],
})
export class ExampleModule {}
11 changes: 11 additions & 0 deletions packages/api/src/feature/_example/repository/example.repository.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Injectable, Inject } from "@nestjs/common";

import { MySql2Database } from "drizzle-orm/mysql2";
import { DrizzleAsyncProvider } from "src/drizzle/drizzle.provider";

@Injectable()
export class ExampleRepository {
constructor(
@Inject(DrizzleAsyncProvider) private readonly db: MySql2Database,
) {}
}
7 changes: 7 additions & 0 deletions packages/api/src/feature/_example/service/example.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Injectable } from "@nestjs/common";
import { ExampleRepository } from "../repository/example.repository";

@Injectable()
export class ExampleService {
constructor(private readonly exampleRepository: ExampleRepository) {}
}
Loading

0 comments on commit 929c7cd

Please sign in to comment.