-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'BE/release' into BE/story/record-spot
- Loading branch information
Showing
15 changed files
with
725 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# name: musicspot github actions | ||
|
||
# on: | ||
# pull_request: | ||
# branches: ["BE/release"] | ||
# types: ["closed"] | ||
# jobs: | ||
# deploy: | ||
# runs-on: ubuntu-latest | ||
|
||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v2 | ||
|
||
# - name: Set up Node.js | ||
# uses: actions/setup-node@v2 | ||
# with: | ||
# node-version: "20" | ||
|
||
# - name: Install dependencies | ||
# run: | | ||
# cd BE | ||
# cd musicspot | ||
# npm install | ||
|
||
# - name: Build Docker image | ||
# run: docker build -t musicspot:latest ./BE/musicspot | ||
|
||
# - name: Login to Docker Hub | ||
# run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
# - name: Push Docker image to Docker Hub | ||
# run: docker push musicspot | ||
|
||
# - name: SSH into Ubuntu server and pull the latest image | ||
# uses: appleboy/ssh-action@master | ||
# with: | ||
# host: ${{ secrets.SERVER_IP }} | ||
# username: ${{ secrets.SERVER_USERNAME }} | ||
# password: ${{ secrets.PASSWORD }} | ||
# script: | | ||
# docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
# docker pull musicspot | ||
# docker stop musicspot || true | ||
# docker rm musicspot || true | ||
# docker run -e SSH_HOST=${{ secrets.SSH_HOST }} -e SSH_PORT=${{ secrets.SSH_PORT }} -e SSH_USER=${{ secrets.SSH_USER }} -e SSH_PASSWORD=${{ secrets.SSH_PASSWORD }} -e DB_USERNAME=${{ secrets.DB_USERNAME }} -e DB_PASSWORD=${{ secrets.DB_PASSWORD }} -e DB_NAME=${{ secrets.DB_NAME }} -e DB_HOST=${{ secrets.DB_HOST }} -e SECRET_KEY=${{ secrets.SECRET_KEY }} -v /images:/images -v /images/profile:/images/profile -v /images/story:/images/story -d -p 3000:3000 --name heatpick-container geomgichoi/heatpick |
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,4 @@ | ||
.git | ||
Dockerfile | ||
node_modules | ||
dist |
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 @@ | ||
MONGODB_URI=mongodb://localhost:27017/musicspot |
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,8 @@ | ||
FROM node:18 | ||
RUN mkdir -p /var/app | ||
WORKDIR /var/app | ||
COPY . . | ||
RUN npm install | ||
RUN npm run build | ||
EXPOSE 3000 | ||
CMD ["node", "dist/main.js"] |
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,15 @@ | ||
import { | ||
ArrayMaxSize, | ||
ArrayMinSize, | ||
IsArray, | ||
IsNumber, | ||
IsString, | ||
} from 'class-validator'; | ||
|
||
export class EndJourneyDTO { | ||
@IsString() | ||
readonly _id: string; | ||
|
||
// @IsString() | ||
// readonly timestamp: string; | ||
} |
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 |
---|---|---|
@@ -1,18 +1,59 @@ | ||
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'; | ||
import { User, UserSchema } from '../user/user.schema'; | ||
import { Journey, JourneySchema } from './journey.schema'; | ||
import { getModelToken } from '@nestjs/mongoose'; | ||
|
||
describe('JourneyController', () => { | ||
let controller: JourneyController; | ||
let userModel; | ||
let journeyModel; | ||
|
||
beforeEach(async () => { | ||
beforeAll(async () => { | ||
mongoose.connect('mongodb://192.168.174.128:27017/musicspotDB'); | ||
userModel = mongoose.model(User.name, UserSchema); | ||
journeyModel = mongoose.model(Journey.name, JourneySchema); | ||
const module: TestingModule = await Test.createTestingModule({ | ||
controllers: [JourneyController], | ||
providers: [ | ||
JourneyService, | ||
{ | ||
provide: getModelToken(Journey.name), | ||
useValue: journeyModel, | ||
}, | ||
{ | ||
provide: getModelToken(User.name), | ||
useValue: userModel, | ||
}, | ||
], | ||
|
||
}).compile(); | ||
|
||
controller = module.get<JourneyController>(JourneyController); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(controller).toBeDefined(); | ||
it('/POST journey 테스트', async () => { | ||
const coordinate = [37.675987, 126.776033]; | ||
const timestamp = '2023-11-22T15:30:00.000+09:00'; | ||
const email = 'test-email'; | ||
|
||
const JourneyData: StartJourneyDTO = { | ||
coordinate, | ||
timestamp, | ||
email, | ||
}; | ||
const createdJourneyData = await controller.create(JourneyData); | ||
expect(coordinate).toEqual(createdJourneyData.coordinates[0]); | ||
expect(timestamp).toEqual(createdJourneyData.timestamp); | ||
expect(createdJourneyData.spots).toEqual([]); | ||
}); | ||
|
||
afterAll(async () => { | ||
mongoose.connection.close(); | ||
|
||
}); | ||
}); |
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
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
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
Oops, something went wrong.