Skip to content

Commit 70ed9d8

Browse files
committed
[FEAT]#37 태풍 예측 테스트용 API개발
1 parent b5a1818 commit 70ed9d8

7 files changed

+923
-30
lines changed

prisma/schema.prisma

+22-26
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// This is your Prisma schema file,
2-
// learn more about it in the docs: https://pris.ly/d/prisma-schema
3-
41
generator client {
52
provider = "prisma-client-js"
63
}
@@ -11,32 +8,31 @@ datasource db {
118
}
129

1310
model Typhoon {
14-
typhoon_id Int @id
15-
name String @db.VarChar(30)
16-
start_date DateTime
17-
end_date DateTime?
18-
created_at DateTime @default(now())
19-
updated_at DateTime @default(now()) @updatedAt
20-
11+
typhoon_id Int @id
12+
name String @db.VarChar(30)
13+
start_date DateTime
14+
end_date DateTime?
15+
created_at DateTime @default(now())
16+
updated_at DateTime @default(now()) @updatedAt
17+
around_weathers TyphoonAroundWeather[]
2118
historical_details TyphoonDetail[]
22-
arrounds TyphoonAroundWeather[]
2319
2420
@@map("typhoons")
2521
}
2622

2723
model TyphoonDetail {
28-
typhoon_id Int
29-
observation_date DateTime
30-
central_longitude Float
31-
central_latitude Float
32-
central_pressure Float
24+
typhoon_id Int
25+
observation_date DateTime
26+
central_longitude Float
27+
central_latitude Float
28+
central_pressure Float
29+
wind_radius Float?
30+
grade Int
31+
created_at DateTime @default(now())
32+
updated_at DateTime @default(now()) @updatedAt
3333
maximum_wind_speed Float
34-
wind_radius Float?
35-
grade Int
36-
created_at DateTime @default(now())
37-
updated_at DateTime @default(now()) @updatedAt
38-
39-
typhoon Typhoon @relation(fields: [typhoon_id], references: [typhoon_id])
34+
around_weathers TyphoonAroundWeather[]
35+
typhoon Typhoon @relation(fields: [typhoon_id], references: [typhoon_id])
4036
4137
@@id([typhoon_id, observation_date])
4238
@@map("typhoon_details")
@@ -59,10 +55,10 @@ model TyphoonAroundWeather {
5955
winddirection_10m Float?
6056
winddirection_100m Float?
6157
windgusts_10m Float?
62-
created_at DateTime @default(now())
63-
updated_at DateTime @default(now()) @updatedAt
64-
65-
typhoon Typhoon @relation(fields: [typhoon_id], references: [typhoon_id])
58+
created_at DateTime @default(now())
59+
updated_at DateTime @default(now()) @updatedAt
60+
typhoon Typhoon @relation(fields: [typhoon_id], references: [typhoon_id])
61+
typhoon_detail TyphoonDetail @relation(fields: [typhoon_id, observation_date], references: [typhoon_id, observation_date])
6662
6763
@@id([typhoon_id, observation_date, point])
6864
@@map("typhoon_around_weathers")

src/app/typhoon/dto/typhoon_arount_weather.dto.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class TyphoonAroundWeatherDTO {
1111
typhoon_id: number;
1212

1313
@ApiProperty({
14-
name: 'datetime',
14+
name: 'observation_date',
1515
description: '태풍 관측 시간',
1616
type: 'Date',
1717
})

src/app/typhoon/dto/typhoon_detail.dto.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ApiProperty } from '@nestjs/swagger';
22
import { IsDateString, IsNumber } from 'class-validator';
3+
import { TyphoonAroundWeatherDTO } from './typhoon_arount_weather.dto';
34

45
export class TyphoonDetailDTO {
56
@ApiProperty({
@@ -11,7 +12,7 @@ export class TyphoonDetailDTO {
1112
typhoon_id: number;
1213

1314
@ApiProperty({
14-
name: '관측시간',
15+
name: 'observation_date',
1516
description: '태풍 관측 시간',
1617
type: 'Date',
1718
})
@@ -65,4 +66,12 @@ export class TyphoonDetailDTO {
6566
})
6667
@IsNumber()
6768
grade: number;
69+
70+
@ApiProperty({
71+
name: 'around_weathers',
72+
description: '태풍 주변 날씨 프론트에는 해당하지않습니다',
73+
type: () => TyphoonAroundWeatherDTO,
74+
isArray: true,
75+
})
76+
arround_weathers?: TyphoonAroundWeatherDTO[];
6877
}

0 commit comments

Comments
 (0)