Skip to content

Commit

Permalink
Merge pull request #4 from DEV-dsm/databaseSetting
Browse files Browse the repository at this point in the history
(#3) 🗃️ :: db ::Table Setting
  • Loading branch information
12xii authored Oct 5, 2023
2 parents 4938d93 + c341052 commit 9c87884
Show file tree
Hide file tree
Showing 35 changed files with 1,156 additions and 5 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "test",
"start": "start"
"start": "cd src && ts-node index.ts"
},
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions src/enums/amount.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export enum Amount {
increase = '증가',
nothing = '변화 없음',
decrease = '감소'
}
3 changes: 3 additions & 0 deletions src/enums/businessType.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export enum BusinessType {

}
3 changes: 3 additions & 0 deletions src/enums/clubType.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export enum ClubType {

}
4 changes: 4 additions & 0 deletions src/enums/key.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum Key {
budgetSum = '예산액',
execution = '집행액'
}
4 changes: 4 additions & 0 deletions src/enums/loc.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum Loc {
mannyeon = '만년동',
gajang = '가장동',
}
7 changes: 7 additions & 0 deletions src/enums/related.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export enum Related {
veryDislike = '매우 그렇지 않다',
not = '그렇지 않다',
normal = '보통이다',
yes = '그렇다',
veryTrue = '매우 그렇다'
}
4 changes: 4 additions & 0 deletions src/enums/sex.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum Sex {
male = '남성',
female = '여성'
}
4 changes: 4 additions & 0 deletions src/enums/total.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum Total {
num = '총횟수',
people = '총인원'
}
5 changes: 5 additions & 0 deletions src/enums/type.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export enum Type {
judge = '심사',
choice = '선정',
fail = '탈락'
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ configDotenv();
const app = express();
const port = process.env.PORT || 8000;

AppDataSource.initialize()
await AppDataSource.initialize()
.then(() => { console.log(`DB has initted`) })
.catch((err) => { console.error(err) })

Expand Down
39 changes: 39 additions & 0 deletions src/models/achievementStatus.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Column, Entity, JoinColumn, OneToOne, PrimaryColumn, Relation } from "typeorm";
import { Amount } from "../enums/amount.enum.js";
import { Related } from "../enums/related.enum.js";
import { PerformanceResult } from "./performanceResult.entity.js";

@Entity()
export class AchievementStatus {
// 기대 사항 달성 정도

@PrimaryColumn()
id!: number;

@OneToOne(
() => PerformanceResult,
performanceResult => performanceResult.achievementStatus
)
@JoinColumn({ name: 'id' })
performanceResult!: Relation<PerformanceResult>;

@Column({
type: 'varchar'
})
changedMember!: Relation<Amount>;

@Column({
type: 'varchar'
})
increaseMain!: Relation<Amount>;

@Column({
type: 'varchar'
})
increaseNew!: Relation<Amount>;

@Column({
type: 'varchar'
})
changedRelation!: Relation<Related>;
}
47 changes: 47 additions & 0 deletions src/models/budgetDetail.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
import { BusinessPlan } from "./businessPlan.entity.js";

@Entity()
export class BudgetDetail {
// 예산 상세

@PrimaryGeneratedColumn()
id!: number;

@ManyToOne(
() => BusinessPlan,
businessPlan => businessPlan.budgetDetail
)
@JoinColumn({ name: 'id' })
businessPlan!: BusinessPlan;

@Column({
type: 'varchar'
})
budgetHead!: string;

@Column({
type: 'varchar'
})
budgetOrganization!: string;

@Column({
type: 'varchar'
})
subsidy!: string;

@Column({
type: 'integer'
})
subsidyBudget!: number;

@Column({
type: 'varchar'
})
self!: string;

@Column({
type: 'integer'
})
selfBudget!: number;
}
67 changes: 67 additions & 0 deletions src/models/budgetPlan.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { Column, Entity, JoinColumn, OneToOne, PrimaryColumn, Relation } from "typeorm";
import { BusinessPlan } from "./businessPlan.entity.js";

@Entity()
export class BudgetPlan {
// 예산 기획

@PrimaryColumn({
type: 'integer'
})
id!: number;

@OneToOne(
() => BusinessPlan,
businessPlan => businessPlan.budgetPlan
)
@JoinColumn({ name: 'id' })
businessPlan!: Relation<BusinessPlan>;

@Column({
type: 'integer',
nullable: true
})
subsidyMeal?: number;

@Column({
type: 'integer',
nullable: true
})
subsidyActivity?: number;

@Column({
type: 'integer',
nullable: true
})
subsidyOperating?: number;

@Column({
type: 'integer',
nullable: true
})
subsidyFacility?: number;

@Column({
type: 'integer',
nullable: true
})
selfMeal?: number;

@Column({
type: 'integer',
nullable: true
})
selfActivity?: number;

@Column({
type: 'integer',
nullable: true
})
selfOperating?: number;

@Column({
type: 'integer',
nullable: true
})
selfFacility?: number;
}
34 changes: 34 additions & 0 deletions src/models/budgetResult.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
import { Key } from "../enums/key.enum.js";
import { ResultReport } from "./resultReport.entity.js";

@Entity()
export class BudgetResult {
// 예산 상세 결과

@PrimaryColumn()
id!: number;

@ManyToOne(
() => ResultReport,
resultReport => resultReport.budgetResult
)
@JoinColumn({ name: 'id' })
resultReport!: ResultReport;

@Column({
type: 'integer'
})
subsidy!: number;

@Column({
type: 'integer'
})
burden!: number;

@Column({
type: 'varchar'
})
key!: Key;
}
Loading

0 comments on commit 9c87884

Please sign in to comment.