From ff2f4ee4707c16d47ea47b6c1b91fc1138426df7 Mon Sep 17 00:00:00 2001 From: 12xii Date: Sat, 30 Sep 2023 13:35:43 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20::=20db=20::=20business?= =?UTF-8?q?Table=20Setting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - table setting --- package.json | 3 +- src/enums/businessType.enum.ts | 10 ++++ src/enums/clubType.enum.ts | 5 ++ src/enums/loc.enum.ts | 3 + src/models/business.ts | 101 +++++++++++++++++++++++++++++++++ src/models/dataSource.ts | 3 +- src/models/index.ts | 0 7 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 src/enums/businessType.enum.ts create mode 100644 src/enums/clubType.enum.ts create mode 100644 src/enums/loc.enum.ts create mode 100644 src/models/business.ts delete mode 100644 src/models/index.ts diff --git a/package.json b/package.json index 73d925b..949b7ce 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,7 @@ "description": "", "main": "index.js", "scripts": { - "test": "test", - "start": "start" + "start": "cd src && ts-node index.ts" }, "repository": { "type": "git", diff --git a/src/enums/businessType.enum.ts b/src/enums/businessType.enum.ts new file mode 100644 index 0000000..7382b23 --- /dev/null +++ b/src/enums/businessType.enum.ts @@ -0,0 +1,10 @@ +export enum businessType { + yuseongMagic = '유성매직네트워크', + recordImage = '기록 영상', + publicOpinion = '공론', + alleyEconomy = '골목경제', + careSystem = '돌봄체계 구축', + olderLeisure = '노년층 여가활동', + sharePlace = '공유공간 활성화', + livinglab = '리빙랩' +} \ No newline at end of file diff --git a/src/enums/clubType.enum.ts b/src/enums/clubType.enum.ts new file mode 100644 index 0000000..9eb33a8 --- /dev/null +++ b/src/enums/clubType.enum.ts @@ -0,0 +1,5 @@ +export enum clubType { + residentMeeting = '주민모임', + npPrivateOrg = '비영리민간단체', + npCorporation = '비영리법인' +} \ No newline at end of file diff --git a/src/enums/loc.enum.ts b/src/enums/loc.enum.ts new file mode 100644 index 0000000..0894284 --- /dev/null +++ b/src/enums/loc.enum.ts @@ -0,0 +1,3 @@ +export enum loc { + +} \ No newline at end of file diff --git a/src/models/business.ts b/src/models/business.ts new file mode 100644 index 0000000..f18d9fe --- /dev/null +++ b/src/models/business.ts @@ -0,0 +1,101 @@ +import { Column, Entity, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm"; +import { businessType } from "../enums/businessType.enum.js"; +import { clubType } from "../enums/clubType.enum.js"; +import { loc } from "../enums/loc.enum.js"; + +@Entity() +export class Business { + @PrimaryGeneratedColumn() + id!: number; + + @Column({ + type: 'varchar' + }) + businessType!: businessType; + + @Column({ + type: 'varchar' + }) + clubName!: string; + + @Column({ + type: 'boolean' + }) + isContiguous!: boolean; + + @Column({ + type: 'varchar', + nullable: true + }) + contiguousLocation?: loc; + + @Column({ + type: 'varchar' + }) + businessName!: string; + + @Column({ + type: 'integer' + }) + totalBudget!: number; + + @Column({ + type: 'integer' + }) + subsidy!: number; + + @Column({ + type: 'integer' + }) + selfInflicted!: number; + + @Column({ + type: 'varchar' + }) + clubType!: clubType; + + @Column({ + type: 'integer' + }) + countOfManager!: number; + + @Column({ + type: 'integer', + default: 0 + }) + countOfMember!: number; + + @Column({ + type: 'varchar', + nullable: true + }) + clubAddress?: string; + + @Column({ + type: 'integer' + }) + clubRegisterNumber!: number; + + @Column({ + type: 'boolean', + default: false + }) + isIncludingInfo!: boolean; + + @Column({ + type: 'boolean', + default: false + }) + isIncludingMemberList!: boolean; + + @Column({ + type: 'boolean', + default: false + }) + isIncludingPlan!: boolean; + + @Column({ + type: 'integer' + }) + year!: number; +} \ No newline at end of file diff --git a/src/models/dataSource.ts b/src/models/dataSource.ts index 50f7835..7a7f70e 100644 --- a/src/models/dataSource.ts +++ b/src/models/dataSource.ts @@ -1,6 +1,7 @@ import { configDotenv } from "dotenv"; import "reflect-metadata"; import { DataSource } from "typeorm"; +import { Business } from "./business.js"; configDotenv(); @@ -13,7 +14,7 @@ export const AppDataSource = new DataSource({ database: process.env.DB_NAME, synchronize: true, logging: false, - entities: [], + entities: [Business], migrations: [], subscribers: [], }); \ No newline at end of file diff --git a/src/models/index.ts b/src/models/index.ts deleted file mode 100644 index e69de29..0000000