Skip to content

Commit

Permalink
Merge pull request #212 from innovationacademy-kr/develop
Browse files Browse the repository at this point in the history
develop to main
  • Loading branch information
niamu01 authored Jul 18, 2024
2 parents 87b50b0 + 67cda1a commit 0004a0a
Show file tree
Hide file tree
Showing 37 changed files with 342 additions and 192 deletions.
98 changes: 33 additions & 65 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "24hane",
"version": "5.0.0",
"version": "5.1.0",
"description": "24Hane Backend Server",
"author": "joohongpark, niamu01, enaenen",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion src/auth/auth.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Inject, Injectable, Logger } from '@nestjs/common';
import { IAuthRepository } from './repository/auth.repository.interface';
import { UserSessionDto } from 'src/auth/dto/user.session.dto';
import { IAuthRepository } from './repository/auth.repository.interface';

@Injectable()
export class AuthService {
Expand Down
4 changes: 2 additions & 2 deletions src/auth/guard/jwt-sign.guard.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Request, Response } from 'express';
import {
CanActivate,
ExecutionContext,
Injectable,
Logger,
} from '@nestjs/common';
import { Observable } from 'rxjs';
import { JwtService } from '@nestjs/jwt';
import { Request, Response } from 'express';
import { Observable } from 'rxjs';
import { UserSessionDto } from 'src/auth/dto/user.session.dto';

/**
Expand Down
4 changes: 2 additions & 2 deletions src/auth/srategy/auth.admin.strategy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ExtractJwt, Strategy } from 'passport-jwt';
import { PassportStrategy } from '@nestjs/passport';
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { PassportStrategy } from '@nestjs/passport';
import { ExtractJwt, Strategy } from 'passport-jwt';
import { UserSessionDto } from '../dto/user.session.dto';

/**
Expand Down
4 changes: 2 additions & 2 deletions src/auth/srategy/auth.external.strategy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ExtractJwt, Strategy } from 'passport-jwt';
import { PassportStrategy } from '@nestjs/passport';
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { PassportStrategy } from '@nestjs/passport';
import { ExtractJwt, Strategy } from 'passport-jwt';

/**
* ์™ธ๋ถ€ API์šฉ passport-jwt Strategy
Expand Down
4 changes: 2 additions & 2 deletions src/auth/srategy/auth.strategy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ExtractJwt, Strategy } from 'passport-jwt';
import { PassportStrategy } from '@nestjs/passport';
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { PassportStrategy } from '@nestjs/passport';
import { ExtractJwt, Strategy } from 'passport-jwt';
import { UserSessionDto } from '../dto/user.session.dto';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/entities/alive.entity.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Cluster from 'src/enums/cluster.enum';
import { Entity, Column, Index, PrimaryGeneratedColumn } from 'typeorm';
import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';

// deprecated
@Entity()
Expand Down
2 changes: 1 addition & 1 deletion src/entities/card-issuance.entity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
Entity,
Column,
Entity,
JoinColumn,
ManyToOne,
PrimaryGeneratedColumn,
Expand Down
2 changes: 1 addition & 1 deletion src/entities/device-info.entity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Cluster from 'src/enums/cluster.enum';
import InOut from 'src/enums/inout.enum';
import { Entity, Column, PrimaryColumn } from 'typeorm';
import { Column, Entity, PrimaryColumn } from 'typeorm';

@Entity('DEVICE_INFO')
export class DeviceInfo {
Expand Down
2 changes: 1 addition & 1 deletion src/entities/inout.entity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Cluster from 'src/enums/cluster.enum';
import InOut from 'src/enums/inout.enum';
import { Entity, Column, Index, PrimaryGeneratedColumn } from 'typeorm';
import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';

// deprecated
@Entity()
Expand Down
2 changes: 1 addition & 1 deletion src/entities/tag-log.entity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm';
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';

@Entity('TAG_LOG')
export class TagLog {
Expand Down
2 changes: 1 addition & 1 deletion src/entities/user-info.entity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Entity, Column, OneToMany, PrimaryColumn } from 'typeorm';
import { Column, Entity, OneToMany, PrimaryColumn } from 'typeorm';
import { CardIssuance } from './card-issuance.entity';

@Entity('USER_INFO')
Expand Down
2 changes: 1 addition & 1 deletion src/enums/cluster.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
*/
enum Cluster {
GAEPO = 'GAEPO',
SEOCHO = 'SEOCHO',
//SEOCHO = 'SEOCHO',
}
export default Cluster;
8 changes: 5 additions & 3 deletions src/external/where42/dto/where42.response.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ export class Where42ResponseDto {
example: Cluster.GAEPO,
})
cluster: Cluster;
}

export class Where42RequestDto {
@ApiProperty({
description: '๋งˆ์ง€๋ง‰์œผ๋กœ ํƒœ๊น…ํ•œ ์‹œ๊ฐ„',
type: Date,
description: '42 ๋กœ๊ทธ์ธ ID',
example: 'yeju',
})
tag_at: Date;
login: string;
}
49 changes: 47 additions & 2 deletions src/external/where42/where42.controller.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import { Controller, Get, Logger, Param, UseGuards } from '@nestjs/common';
import {
Body,
Controller,
Get,
Logger,
Param,
Post,
UseGuards,
} from '@nestjs/common';
import {
ApiBearerAuth,
ApiBody,
ApiOperation,
ApiParam,
ApiResponse,
ApiTags,
} from '@nestjs/swagger';
import { ExtAuthGuard } from 'src/auth/guard/ext-auth.guard';
import { Where42ResponseDto } from './dto/where42.response.dto';
import {
Where42RequestDto,
Where42ResponseDto,
} from './dto/where42.response.dto';
import { Where42Service } from './where42.service';

@ApiTags('Where42 ์ „์šฉ API')
Expand Down Expand Up @@ -50,4 +62,37 @@ export class Where42Controller {
this.logger.debug(`@islogin) where42: ${login}`);
return this.where42Service.where42(login);
}

/**
* ์—ฌ๋Ÿฌ ์‚ฌ์šฉ์ž๊ฐ€ ํด๋Ÿฌ์Šคํ„ฐ์— ์ฒด๋ฅ˜์ค‘์ธ์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
*
* @param logins ์œ ์ € ๋กœ๊ทธ์ธ ID (Where42RequestDto) ๋ฆฌ์ŠคํŠธ
* @returns Where42ResponseDto[]
*/
@ApiOperation({
summary: '์—ฌ๋Ÿฌ ์นด๋Žƒ๋“ค์˜ ํด๋Ÿฌ์Šคํ„ฐ ์ฒด๋ฅ˜์—ฌ๋ถ€ ํ™•์ธ',
description:
'์—ฌ๋Ÿฌ๋ช…์˜ ์นด๋Žƒ์ด ํด๋Ÿฌ์Šคํ„ฐ์— ์ฒด๋ฅ˜์ค‘์ธ์ง€ ํ•œ๋ฒˆ์— ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. ๋งˆ์ง€๋ง‰์œผ๋กœ ์ฒด๋ฅ˜ํ–ˆ๋˜ ์ฒด๋ฅ˜์ค‘์ธ ํด๋Ÿฌ์Šคํ„ฐ์˜ ์žฅ์†Œ ์ •๋ณด๋„ ํ•จ๊ป˜ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.',
})
@ApiResponse({
status: 200,
type: Where42ResponseDto,
isArray: true,
description: '์กฐํšŒ ์„ฑ๊ณต',
})
@ApiResponse({ status: 401, description: '์ ‘๊ทผ ๊ถŒํ•œ ์—†์Œ (ํ† ํฐ ๋งŒ๋ฃŒ ๋“ฑ)' })
@ApiResponse({ status: 403, description: 'ํƒœ๊ทธ ๊ธฐ๋ก์ด ์กด์žฌํ•˜์ง€ ์•Š๋Š” ์นด๋Žƒ' })
@ApiResponse({ status: 500, description: '์„œ๋ฒ„ ๋‚ด๋ถ€ ์—๋Ÿฌ' })
@ApiBody({
type: [Where42RequestDto],
description: '์œ ์ € ๋กœ๊ทธ์ธ ID ๊ฐ์ฒด์˜ ๋ฐฐ์—ด',
})
@Post('where42/where42All')
async where42All(
@Body() logins: Where42RequestDto[],
): Promise<Where42ResponseDto[]> {
this.logger.debug(`@where42All) where42All`);
const loginList = logins.map((loginDto) => loginDto.login);
return this.where42Service.where42All(loginList);
}
}
7 changes: 6 additions & 1 deletion src/external/where42/where42.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { DeviceInfo } from 'src/entities/device-info.entity';
import { TagLog } from 'src/entities/tag-log.entity';
import { TagLogRepository } from 'src/tag-log/repository/mysql/tag-log.repository';
import { UserModule } from 'src/user/user.module';
import { DateCalculatorModule } from 'src/utils/data-calculator/data-calculator.module';
import { DeviceInfoRepository } from './repository/mysql/device-info.repository';
import { Where42Controller } from './where42.controller';
import { Where42Service } from './where42.service';
Expand All @@ -22,7 +23,11 @@ const deviceInfoRepo = {
* 24Hane ๊ธฐ๋Šฅ ์™ธ ๋‹ค๋ฅธ ์„œ๋น„์Šค์—์„œ ์‚ฌ์šฉํ•˜๋Š” ์™ธ๋ถ€ API ๋ชจ๋“ˆ
*/
@Module({
imports: [UserModule, TypeOrmModule.forFeature([DeviceInfo, TagLog])],
imports: [
UserModule,
TypeOrmModule.forFeature([DeviceInfo, TagLog]),
DateCalculatorModule,
],
controllers: [Where42Controller],
providers: [tagLogRepo, deviceInfoRepo, Where42Service],
})
Expand Down
Loading

0 comments on commit 0004a0a

Please sign in to comment.