Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] 여정 기록 api #97

Merged
merged 33 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
19b2ac8
swagger 설정
twoo1999 Nov 13, 2023
7e94dc5
:sparkles: MongoDB 설정
twoo1999 Nov 15, 2023
3111b16
:memo: Dependency 추가
twoo1999 Nov 15, 2023
9efb3e6
:sparkles: 검증 파이프 추가
twoo1999 Nov 15, 2023
fe46057
:art: 잡다한 코드 수정
twoo1999 Nov 15, 2023
6f6bee6
:sparkles: Journal 추가 기능 추가
twoo1999 Nov 15, 2023
c383546
test
twoo1999 Nov 15, 2023
1c884b3
test 제거
twoo1999 Nov 15, 2023
6dcc572
:sparkles: Person 모듈 추가
twoo1999 Nov 16, 2023
3418eba
:test_tube: Person 모듈 테스트
twoo1999 Nov 16, 2023
725c302
:sparkles: Journal 아이디 추가 구현
twoo1999 Nov 16, 2023
94583b1
:test_tube: 사용자 데이터에 journal id 추가하는 기능 테스트
twoo1999 Nov 16, 2023
5a1bf8e
:art: 의존성 추가를 위한 작업
twoo1999 Nov 16, 2023
358e5d1
:bug: Import 수정
twoo1999 Nov 16, 2023
0653d02
:sparkles: Spot 저장 구현
twoo1999 Nov 16, 2023
9df9e87
:test_tube: Spot 저장 테스트 구현
twoo1999 Nov 16, 2023
cbc7aee
Merge pull request #82 from boostcampwm2023/BE/task/record-spot-witho…
vvans Nov 20, 2023
f82aaf5
ad
twoo1999 Nov 20, 2023
652388e
resolve conflict
twoo1999 Nov 20, 2023
c156b02
:art: Rename modules
twoo1999 Nov 20, 2023
acfe16b
rename merge
twoo1999 Nov 20, 2023
a966f2c
:art: Rename spot module
twoo1999 Nov 20, 2023
f5b3f82
:sparkles: Spot 생성 및 spot id 추가
twoo1999 Nov 20, 2023
ac44a95
Merge pull request #87 from boostcampwm2023/BE/task/record-spot-witho…
vvans Nov 21, 2023
421e067
:sparkles: Object storage dependency 추가
twoo1999 Nov 21, 2023
270312c
:recycle: Change schema
twoo1999 Nov 21, 2023
0ebf228
:package: Create 메서드 분리
twoo1999 Nov 21, 2023
ba6b149
:test_tube: SpotService 테스트 코드 추가
twoo1999 Nov 21, 2023
5cbfb79
:sparkles: swagger api 설명 추가
twoo1999 Nov 22, 2023
c40dc7b
:recycle: 환경변수를 통한 보안 강화
twoo1999 Nov 22, 2023
a5a6b15
:recycle: Storage 접근 시 환경변수 사용
twoo1999 Nov 22, 2023
6720d9c
Merge pull request #92 from boostcampwm2023/BE/task/record-spot-with-…
vvans Nov 23, 2023
86d7bed
Merge branch 'BE/release' into BE/story/record-spot
twoo1999 Nov 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 119 additions & 14 deletions BE/musicspot/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion BE/musicspot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"@nestjs/mongoose": "^10.0.2",
"@nestjs/platform-express": "^10.0.0",
"@nestjs/swagger": "^7.1.15",

"@types/multer": "^1.4.10",
"aws-sdk": "^2.348.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"gitmoji-cli": "^9.0.0",
Expand Down
3 changes: 2 additions & 1 deletion BE/musicspot/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AppController } from './app.controller';
import { AppService } from './app.service';
import { MongooseModule } from '@nestjs/mongoose';
import { JourneyModule } from './journey/journey.module';

import { SpotModule } from './spot/spot.module';
import { UserModule } from './user/user.module';
@Module({
imports: [
Expand All @@ -12,6 +12,7 @@ import { UserModule } from './user/user.module';
),
JourneyModule,
UserModule,
SpotModule,
],
controllers: [AppController],
providers: [AppService],
Expand Down
3 changes: 3 additions & 0 deletions BE/musicspot/src/journey/journey.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Test, TestingModule } from '@nestjs/testing';
import { JourneyController } from './journey.controller';

import { StartJourneyDTO } from './dto/journeyStart.dto';
import { JourneyService } from './journey.service';
import mongoose from 'mongoose';
Expand Down Expand Up @@ -29,6 +30,7 @@ describe('JourneyController', () => {
useValue: userModel,
},
],

}).compile();

controller = module.get<JourneyController>(JourneyController);
Expand All @@ -52,5 +54,6 @@ describe('JourneyController', () => {

afterAll(async () => {
mongoose.connection.close();

});
});
3 changes: 3 additions & 0 deletions BE/musicspot/src/journey/journey.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { StartJourneyDTO } from './dto/journeyStart.dto';
import { ApiCreatedResponse, ApiOperation, ApiTags } from '@nestjs/swagger';
import { Journey } from './journey.schema';
import { EndJourneyDTO } from './dto/journeyEnd.dto';

@Controller('journey')
@ApiTags('journey 관련 API')
export class JourneyController {
Expand All @@ -18,6 +19,7 @@ export class JourneyController {
description: '생성된 여정 데이터를 반환',
type: Journey,
})

@Post('start')
async create(@Body() startJourneyDTO: StartJourneyDTO) {
return await this.journeyService.create(startJourneyDTO);
Expand All @@ -34,4 +36,5 @@ export class JourneyController {
async end(@Body() endJourneyDTO: EndJourneyDTO) {
return await this.journeyService.end(endJourneyDTO);
}

}
1 change: 1 addition & 0 deletions BE/musicspot/src/journey/journey.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class Journey {

@Prop({ type: String })
timestamp: string;

}

export const JourneySchema = SchemaFactory.createForClass(Journey);
1 change: 1 addition & 0 deletions BE/musicspot/src/journey/journey.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('JourneysService', () => {
let service: JourneyService;
let userModel;
let journeyModel;

beforeAll(async () => {
mongoose.connect(
`mongodb://${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_NAME}`,
Expand Down
2 changes: 2 additions & 0 deletions BE/musicspot/src/journey/journey.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { InjectModel } from '@nestjs/mongoose';
import { Injectable } from '@nestjs/common';
import { StartJourneyDTO } from './dto/journeyStart.dto';
import { Journey } from './journey.schema';

import { User } from '../user/user.schema';
import { UserService } from '../user/user.service';
import { EndJourneyDTO } from './dto/journeyEnd.dto';
Expand All @@ -14,6 +15,7 @@ export class JourneyService {
@InjectModel(User.name) private userModel: Model<User>,
) {}
async insertJourneyData(startJourneyDTO: StartJourneyDTO) {

const journeyData = {
...startJourneyDTO,
spots: [],
Expand Down
22 changes: 22 additions & 0 deletions BE/musicspot/src/spot/dto/recordSpot.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {
ArrayMaxSize,
ArrayMinSize,
IsArray,
IsNumber,
IsString,
} from 'class-validator';

export class RecordSpotDTO {
@IsString()
readonly journeyId: string;
@IsArray()
@ArrayMaxSize(2, { message: 'coordinate has only 2' })
@ArrayMinSize(2, { message: 'coordinate has only 2' })
@IsNumber({}, { each: true })
readonly coordinate: number[];

@IsString()
readonly timestamp: string;

readonly photoData: Buffer;
}
18 changes: 18 additions & 0 deletions BE/musicspot/src/spot/spot.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { SpotController } from './spot.controller';

describe('SpotController', () => {
let controller: SpotController;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [SpotController],
}).compile();

controller = module.get<SpotController>(SpotController);
});

it('should be defined', () => {
expect(controller).toBeDefined();
});
});
Loading