-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from xodms1701/main
weather 모듈 생성
- Loading branch information
Showing
6 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { WeatherController } from './weather.controller'; | ||
|
||
describe('WeatherController', () => { | ||
let controller: WeatherController; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
controllers: [WeatherController], | ||
}).compile(); | ||
|
||
controller = module.get<WeatherController>(WeatherController); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(controller).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Controller, Get } from '@nestjs/common'; | ||
import { WeatherService } from './weather.service'; | ||
|
||
@Controller('weather') | ||
export class WeatherController { | ||
constructor(private readonly weatherService: WeatherService) {} | ||
|
||
@Get() | ||
async getWeathers() { | ||
return this.weatherService.getWeathers(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { WeatherService } from './weather.service'; | ||
import { WeatherController } from './weather.controller'; | ||
import { PrismaService } from '../prisma.service'; | ||
|
||
@Module({ | ||
providers: [WeatherService, PrismaService], | ||
controllers: [WeatherController], | ||
}) | ||
export class WeatherModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { WeatherService } from './weather.service'; | ||
|
||
describe('WeatherService', () => { | ||
let service: WeatherService; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [WeatherService], | ||
}).compile(); | ||
|
||
service = module.get<WeatherService>(WeatherService); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(service).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { PrismaService } from '../prisma.service'; | ||
|
||
@Injectable() | ||
export class WeatherService { | ||
constructor(private readonly prismaService: PrismaService) {} | ||
|
||
async getWeathers() { | ||
return this.prismaService.recent_weather.findMany(); | ||
} | ||
} |