Skip to content

Commit

Permalink
폴더 수정 완료
Browse files Browse the repository at this point in the history
  • Loading branch information
vvans committed Nov 23, 2023
1 parent 3d06525 commit 3bcfd65
Show file tree
Hide file tree
Showing 20 changed files with 109 additions and 146 deletions.
6 changes: 3 additions & 3 deletions BE/musicspot/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Module } from '@nestjs/common';
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';
import { JourneyModule } from './journey/module/journey.module';
import { SpotModule } from './spot/module/spot.module';
import { UserModule } from './user/module/user.module';
import * as dotenv from 'dotenv';
dotenv.config();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Test, TestingModule } from '@nestjs/testing';
import { JourneyController } from './journey.controller';

import { StartJourneyDTO } from './dto/journeyStart.dto';
import { JourneyService } from './journey.service';
import { StartJourneyDTO } from '.././dto/journeyStart.dto';
import { JourneyService } from '../service/journey.service';
import mongoose from 'mongoose';
import { User, UserSchema } from '../user/user.schema';
import { Journey, JourneySchema } from './journey.schema';
import { User, UserSchema } from '../../user/schema/user.schema';
import { Journey, JourneySchema } from '../schema/journey.schema';
import { getModelToken } from '@nestjs/mongoose';

describe('JourneyController', () => {
Expand All @@ -30,7 +30,6 @@ describe('JourneyController', () => {
useValue: userModel,
},
],

}).compile();

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

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

});
});
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Controller, Post, Body } from '@nestjs/common';
import { JourneyService } from './journey.service';
import { StartJourneyDTO } from './dto/journeyStart.dto';
import { JourneyService } from '../service/journey.service';
import { StartJourneyDTO } from '.././dto/journeyStart.dto';
import { ApiCreatedResponse, ApiOperation, ApiTags } from '@nestjs/swagger';
import { Journey } from './journey.schema';
import { EndJourneyDTO } from './dto/journeyEnd.dto';
import { RecordJourneyDTO } from './dto/journeyRecord.dto';
import { Journey } from '../schema/journey.schema';
import { EndJourneyDTO } from '.././dto/journeyEnd.dto';
import { RecordJourneyDTO } from '.././dto/journeyRecord.dto';

@Controller('journey')
@ApiTags('journey 관련 API')
Expand Down
103 changes: 0 additions & 103 deletions BE/musicspot/src/journey/journey.service.spec.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Module } from '@nestjs/common';
import { JourneyController } from './journey.controller';
import { JourneyService } from './journey.service';
import { JourneyController } from '../controller/journey.controller';
import { JourneyService } from '../service/journey.service';
import { MongooseModule } from '@nestjs/mongoose';
import { JourneySchema, Journey } from './journey.schema';
import { UserService } from '../user/user.service';
import { User, UserSchema } from 'src/user/user.schema';
import { UserModule } from '../user/user.module';
import { JourneySchema, Journey } from '../schema/journey.schema';
import { UserService } from '../../user/serivce/user.service';
import { User, UserSchema } from 'src/user/schema/user.schema';
import { UserModule } from '../../user/module/user.module';

@Module({
imports: [
Expand Down
File renamed without changes.
68 changes: 68 additions & 0 deletions BE/musicspot/src/journey/service/journey.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { Test, TestingModule } from '@nestjs/testing';
import { JourneyService } from './journey.service';
import mongoose from 'mongoose';
import { User, UserSchema } from '../../user/schema/user.schema';
import { Journey, JourneySchema } from '../schema/journey.schema';
import { getModelToken } from '@nestjs/mongoose';
import { StartJourneyDTO } from '../dto/journeyStart.dto';
import { UserService } from '../../user/serivce/user.service';

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}`,
);
userModel = mongoose.model(User.name, UserSchema);
journeyModel = mongoose.model(Journey.name, JourneySchema);

const module: TestingModule = await Test.createTestingModule({
providers: [
JourneyService,
UserService,
{
provide: getModelToken(Journey.name),
useValue: journeyModel,
},
{
provide: getModelToken(User.name),
useValue: userModel,
},
],
}).compile();

service = module.get<JourneyService>(JourneyService);
});

it('journey 시작 테스트', async () => {
const coordinate = [37.675986, 126.776032];
const timestamp = '2023-11-22T15:30:00.000+09:00';
const email = 'test-email';

const createJourneyData: StartJourneyDTO = {
coordinate,
timestamp,
email,
};

const createdJourneyData =
await service.insertJourneyData(createJourneyData);
expect(coordinate).toEqual(createdJourneyData.coordinates[0]);
expect(timestamp).toEqual(createdJourneyData.timestamp);
expect(createdJourneyData.spots).toEqual([]);

const updateUserInfo = await service.pushJourneyIdToUser(
createdJourneyData._id,
email,
);
// console.log(createdUserData);
expect(updateUserInfo.modifiedCount).toEqual(1);
});

afterAll(async () => {
mongoose.connection.close();
});
});
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Model } from 'mongoose';
import { InjectModel } from '@nestjs/mongoose';
import { Injectable } from '@nestjs/common';
import { StartJourneyDTO } from './dto/journeyStart.dto';
import { Journey } from './journey.schema';
import { StartJourneyDTO } from '../dto/journeyStart.dto';
import { Journey } from '../schema/journey.schema';

import { User } from '../user/user.schema';
import { UserService } from '../user/user.service';
import { EndJourneyDTO } from './dto/journeyEnd.dto';
import { RecordJourneyDTO } from './dto/journeyRecord.dto';
import { User } from '../../user/schema/user.schema';
import { UserService } from '../../user/serivce/user.service';
import { EndJourneyDTO } from '../dto/journeyEnd.dto';
import { RecordJourneyDTO } from '../dto/journeyRecord.dto';

@Injectable()
export class JourneyService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
UploadedFile,
} from '@nestjs/common';
import { ApiCreatedResponse, ApiOperation, ApiTags } from '@nestjs/swagger';
import { RecordSpotDTO } from './dto/recordSpot.dto';
import { SpotService } from './spot.service';
import { RecordSpotDTO } from '../dto/recordSpot.dto';
import { SpotService } from '../service/spot.service';
import { FileInterceptor } from '@nestjs/platform-express';
import { Spot } from './spot.schema';
import { Spot } from '../schema/spot.schema';
@Controller('spot')
@ApiTags('spot 관련 API')
export class SpotController {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Module } from '@nestjs/common';
import { SpotController } from './spot.controller';
import { SpotService } from './spot.service';
import { SpotController } from '../controller/spot.controller';
import { SpotService } from '../service/spot.service';
import { MongooseModule } from '@nestjs/mongoose';
import { Spot, SpotSchema } from './spot.schema';
import { Journey, JourneySchema } from 'src/journey/journey.schema';
import { Spot, SpotSchema } from '../schema/spot.schema';
import { Journey, JourneySchema } from 'src/journey/schema/journey.schema';
@Module({
imports: [
MongooseModule.forFeature([
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import * as path from 'path';
import { Test, TestingModule } from '@nestjs/testing';
import { SpotService } from './spot.service';
import mongoose from 'mongoose';
import { Spot, SpotSchema } from './spot.schema';
import { Spot, SpotSchema } from './schema/spot.schema';
import { getModelToken } from '@nestjs/mongoose';

import { Journey, JourneySchema } from '../journey/journey.schema';
import { Journey, JourneySchema } from '../journey/schema/journey.schema';
import { ConfigBase } from 'aws-sdk/lib/config';
describe('SpotService', () => {
let service: SpotService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Model } from 'mongoose';
import { Injectable } from '@nestjs/common';

import { InjectModel } from '@nestjs/mongoose';
import { Spot } from './spot.schema';
import { RecordSpotDTO } from './dto/recordSpot.dto';
import { Journey } from '../journey/journey.schema';
import { Spot } from '../schema/spot.schema';
import { RecordSpotDTO } from '../dto/recordSpot.dto';
import { Journey } from '../../journey/schema/journey.schema';
import * as AWS from 'aws-sdk';

const endpoint = process.env.NCLOUD_ENDPOINT;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Module } from '@nestjs/common';
import { UserController } from './user.controller';
import { UserService } from './user.service';
import { User, UserSchema } from './user.schema';
import { UserController } from '../controller/user.controller';
import { UserService } from '../serivce/user.service';
import { User, UserSchema } from '../schema/user.schema';
import { MongooseModule } from '@nestjs/mongoose';
@Module({
imports: [
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Test, TestingModule } from '@nestjs/testing';
import { UserService } from './user.service';
import { getModelToken } from '@nestjs/mongoose';
import { User, UserSchema } from './user.schema';
import { User, UserSchema } from '../schema/user.schema';
import mongoose from 'mongoose';

describe('UserService', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@nestjs/common';
import { Model } from 'mongoose';
import { InjectModel } from '@nestjs/mongoose';
import { User } from './user.schema';
import { User } from '../schema/user.schema';
@Injectable()
export class UserService {
constructor(@InjectModel(User.name) private userModel: Model<User>) {}
Expand Down

0 comments on commit 3bcfd65

Please sign in to comment.