Skip to content

Commit

Permalink
🗃️ :: db :: db setting
Browse files Browse the repository at this point in the history
- db table setting
  • Loading branch information
12xii committed Oct 4, 2023
1 parent ff2f4ee commit c341052
Show file tree
Hide file tree
Showing 34 changed files with 1,152 additions and 120 deletions.
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 = '감소'
}
11 changes: 2 additions & 9 deletions src/enums/businessType.enum.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
export enum businessType {
yuseongMagic = '유성매직네트워크',
recordImage = '기록 영상',
publicOpinion = '공론',
alleyEconomy = '골목경제',
careSystem = '돌봄체계 구축',
olderLeisure = '노년층 여가활동',
sharePlace = '공유공간 활성화',
livinglab = '리빙랩'
export enum BusinessType {

}
6 changes: 2 additions & 4 deletions src/enums/clubType.enum.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export enum clubType {
residentMeeting = '주민모임',
npPrivateOrg = '비영리민간단체',
npCorporation = '비영리법인'
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 = '집행액'
}
5 changes: 3 additions & 2 deletions src/enums/loc.enum.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export enum loc {

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 c341052

Please sign in to comment.