docs edit readme.md

This commit is contained in:
손승우
2022-09-26 16:39:03 +09:00
parent d88239f8e1
commit 117ae7e46f
11 changed files with 166 additions and 26 deletions

View File

@@ -2,7 +2,9 @@
/config.serverless.yml
/.env.dev
/.env.prod
/.ormconfig.json
/vanillameta
.
# compiled output
/dist
/node_modules

View File

@@ -10,6 +10,7 @@ import { WidgetModule } from './widget/widget.module';
import { DashboardModule } from './dashboard/dashboard.module';
import { TemplateModule } from './template/template.module';
import { CommonModule } from './common/common.module';
import { ComponentModule } from './component/component.module';
@Module({
imports: [
@@ -39,6 +40,7 @@ import { CommonModule } from './common/common.module';
DashboardModule,
TemplateModule,
CommonModule,
ComponentModule,
],
controllers: [AppController],
providers: [AppService],

View File

@@ -0,0 +1,20 @@
import { Test, TestingModule } from '@nestjs/testing';
import { ComponentController } from './component.controller';
import { ComponentService } from './component.service';
describe('ComponentController', () => {
let controller: ComponentController;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [ComponentController],
providers: [ComponentService],
}).compile();
controller = module.get<ComponentController>(ComponentController);
});
it('should be defined', () => {
expect(controller).toBeDefined();
});
});

View File

@@ -0,0 +1,34 @@
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { ComponentService } from './component.service';
import { CreateComponentDto } from './dto/create-component.dto';
import { UpdateComponentDto } from './dto/update-component.dto';
@Controller('component')
export class ComponentController {
constructor(private readonly componentService: ComponentService) {}
@Post()
create(@Body() createComponentDto: CreateComponentDto) {
return this.componentService.create(createComponentDto);
}
@Get()
findAll() {
return this.componentService.findAll();
}
@Get(':id')
findOne(@Param('id') id: string) {
return this.componentService.findOne(+id);
}
@Patch(':id')
update(@Param('id') id: string, @Body() updateComponentDto: UpdateComponentDto) {
return this.componentService.update(+id, updateComponentDto);
}
@Delete(':id')
remove(@Param('id') id: string) {
return this.componentService.remove(+id);
}
}

View File

@@ -0,0 +1,9 @@
import { Module } from '@nestjs/common';
import { ComponentService } from './component.service';
import { ComponentController } from './component.controller';
@Module({
controllers: [ComponentController],
providers: [ComponentService]
})
export class ComponentModule {}

View File

@@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { ComponentService } from './component.service';
describe('ComponentService', () => {
let service: ComponentService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [ComponentService],
}).compile();
service = module.get<ComponentService>(ComponentService);
});
it('should be defined', () => {
expect(service).toBeDefined();
});
});

View File

@@ -0,0 +1,26 @@
import { Injectable } from '@nestjs/common';
import { CreateComponentDto } from './dto/create-component.dto';
import { UpdateComponentDto } from './dto/update-component.dto';
@Injectable()
export class ComponentService {
create(createComponentDto: CreateComponentDto) {
return 'This action adds a new component';
}
findAll() {
return `This action returns all component`;
}
findOne(id: number) {
return `This action returns a #${id} component`;
}
update(id: number, updateComponentDto: UpdateComponentDto) {
return `This action updates a #${id} component`;
}
remove(id: number) {
return `This action removes a #${id} component`;
}
}

View File

@@ -0,0 +1 @@
export class CreateComponentDto {}

View File

@@ -0,0 +1,4 @@
import { PartialType } from '@nestjs/swagger';
import { CreateComponentDto } from './create-component.dto';
export class UpdateComponentDto extends PartialType(CreateComponentDto) {}

View File

@@ -0,0 +1,26 @@
import { Column, Entity, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn } from "typeorm";
@Entity()
export class Dashboard {
@PrimaryGeneratedColumn()
id: number
@Column()
title: string
@Column()
option: string
@Column()
category: string
@Column()
type: string
@CreateDateColumn()
created_at: Date;
@UpdateDateColumn()
updated_at: Date;
}

View File

@@ -1,42 +1,40 @@
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import { BaseEntity } from '../../common/entities/base.entity';
import { CreateDatabaseDto } from '../dto/create-database.dto';
import {Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn, JoinColumn, OneToOne } from "typeorm";
import {Dataset} from "../../dataset/entities/dataset.entity";
@Entity()
export class Database extends BaseEntity {
export class Database {
@PrimaryGeneratedColumn()
id: number;
id: number
@Column()
name: string;
title: string
@Column()
description: string;
type: string
@Column()
details: string;
host: string
@Column()
engine: string;
port: string
@Column()
timezone: string;
userId: string
static of(name: string, description: string, details: string, engine: string, timezone: string): Database {
const obj = new Database();
obj.name = name;
obj.description = description;
obj.details = details;
obj.engine = engine;
obj.timezone = timezone;
return obj;
}
@Column()
userPassword: string
static toDto(dto: CreateDatabaseDto): Database {
return Database.of(dto.name, dto.description, dto.details, dto.engine, dto.timezone);
}
@Column()
schema: string
@CreateDateColumn()
created_at: Date;
@UpdateDateColumn()
updated_at: Date;
@OneToOne(() => Dataset, (dataset) => dataset.database)
@JoinColumn({'name': 'databaseId'})
dataset: Dataset;
getFullDescription(): string {
return `${this.name} ${this.description}`;
}
}