-
Notifications
You must be signed in to change notification settings - Fork 6
[SWEP-60] 날짜별 태그 검색 API, 태그로 이미지 검색 API 기능 구현과 여러 설정 #85
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
Merged
Merged
Changes from all commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
c5e90ee
Initial commit
jjiinaaa 74d3768
Update README.md
jjiinaaa 37c686a
[SWEP-1] Jira Test
jjiinaaa e89ad9f
[SWEP-6] Jira Autumation Test
jjiinaaa 818f37f
[SWEP-6] Jira Autumation Test
jjiinaaa 0654054
[SWEP-17] Server PR Template
jjiinaaa edf482d
Update README.md
jjiinaaa 30a498e
[SWEP-19] Issue Template
jjiinaaa 7a4143e
[SWEP-17] PR Template
jjiinaaa 5e749fb
[SWEP-19] Issue Template
jjiinaaa 8c01216
Update: issue 템플릿 수정 (#6)
jjiinaaa 7e6ba09
[SWEP-12] 초기 설정 및 Readme 파일 구성 (#10)
jjiinaaa 42bb522
[SWEP-22] CI/CD 파이프라인 구축 (#13)
asjasj3964 39883ef
[SWEP-28] GTS 적용 및 코드 컨벤션 문서 정리 (#18)
jjiinaaa c3d8b73
[SWEP-35] Swagger 초기 설정 (#23)
jjiinaaa 04f768f
[SWEP-35] 빌드 시 스웨거 문서 미복사 문제 해결 (#27) (#28)
jjiinaaa f352ca0
[SWEP-43] AWS S3 클라이언트 설정 및 파일 관리 함수 구현 (#36)
asjasj3964 18e85a5
[SWEP-36] schema.prisma 작성완료
GodUser1005 01fafa0
Merge branch 'feat/db-schema' into develop
GodUser1005 3c0409d
[SWEP-36] migration 파일 일부 수정
GodUser1005 75fbe25
[SWEP-36] ./src/models/user.model.ts 에서 UserModel 수정
GodUser1005 d5110da
Merge pull request #39 from GodUser1005/develop
GodUser1005 6f93856
Merge pull request #40 from Sweepic/feature/SWEP-36
GodUser1005 833a63f
[SWEP-42] 메모장 POST API 구현 (#46)
asjasj3964 dbffe8f
[SWEP-37] 위치 기반 챌린지 API
codie0226 430b84b
[SWEP-51] Session 테이블 수정 및 마이그레이션 추가
GodUser1005 42d7c85
Merge pull request #56 from GodUser1005/develop
GodUser1005 c20859e
[SWEP-37] swagger 적용, 피드백 반영 및 코드 수정
codie0226 fac01c8
Merge pull request #57 from Sweepic/fix/SWEP-51
GodUser1005 bdae5d4
Merge pull request #52 from Sweepic/feature/SWEP-37
codie0226 228246f
tsconfig.json update(enable tsoa decorator)
GodUser1005 6fb3189
[SWEP-50] 메모장 조회 API 구현 (#59)
asjasj3964 ac82c5f
[SWEP-40] 소셜 로그인 구현 (#62)
Socializedistp b79cd35
날짜별 태그보기 API 구현
GodUser1005 faa0b9d
Merge branch 'develop' of github.com:GodUser1005/sweepic-Server into …
GodUser1005 d5095f2
feat: 태그 검색기능 구현
GodUser1005 da4df67
chore: tsoa 설정파일 tsoa.json 설정
GodUser1005 dfe67d3
chore: tsconfig.json node 버전 높은버전사용
GodUser1005 fa85890
chore: swagger 폴더 생성 및 정적파일 생성
GodUser1005 b9cd2ae
gitignore update
GodUser1005 3ea7102
resolve conflict
GodUser1005 b07d091
Merge pull request #84 from GodUser1005/develop
GodUser1005 af1f192
resolve conflict app.ts
GodUser1005 87c9238
resolve conflict app.ts, tsconfig.json
GodUser1005 50d7316
[SWEP-60] 스웨거 문서 두개로 나눠 출력, git workflow tsoa 스웨거문서 생성 추가
GodUser1005 418a5f2
Merge branch 'develop' of github.com:GodUser1005/sweepic-Server into …
GodUser1005 5c93237
[SWEP-60] Image관련 파일명 -> tsoaImage로 변환
GodUser1005 51c24e6
[SWEP-60] tsoaRoutes.ts 수정
GodUser1005 5dac6fe
[SWEP-60] build.ts console.log 삭제
GodUser1005 3459b1b
resolve conflict error response
GodUser1005 1190a17
memo-ocr 경로관련 코드 수정
GodUser1005 f3b39f8
[SWEP-60] tsoaResponse 클래스 생성
GodUser1005 6f8a651
[SWEP-60] tag error 응답 통일
GodUser1005 16c237c
[SWEP-60] 태그기반 이미지 검색 응답통일
GodUser1005 cfde138
[SWEP-60] 깃허브 액션 워크플로우 ai-key 전달 추가
GodUser1005 33dcb61
Merge pull request #114 from GodUser1005/develop
GodUser1005 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,24 @@ | ||
| { | ||
| "noImplicitAdditionalProperties": "throw-on-extras", | ||
| "entryFile": "src/app.ts", | ||
| "controllerPathGlobs": ["src/controllers/*.controller.ts"], | ||
| "spec": { | ||
| "outputDirectory": "./swagger", | ||
| "host": "3.37.137.212:3000", | ||
| "specVersion": 3, | ||
| "spec": { | ||
| "servers": [ | ||
| { | ||
| "url": "http://3.37.137.212:3000", | ||
| "description": "Sweepic server" | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "routes": { | ||
| "routesDir": "./src/routers", | ||
| "middleware": "express", | ||
| "routesFileName": "tsoaRoutes.ts", | ||
| "esm": true | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,39 @@ | ||
| import { | ||
| Body, | ||
| Controller, | ||
| Get, | ||
| Path, | ||
| Post, | ||
| Query, | ||
| Res, | ||
| Route, | ||
| SuccessResponse, | ||
| Tags, | ||
| TsoaResponse, | ||
| } from 'tsoa'; | ||
| import {RequestTagSearch} from '../dtos/tsoaImage.dto.js'; | ||
| import {findImagesFromTag} from '../services/tsoaImage.service.js'; | ||
| import {BaseError, ServerError} from '../errors.js'; | ||
| import {Response} from '../models/tsoaResponse.js'; | ||
|
|
||
| @Route('images') | ||
| export class ImagesController extends Controller { | ||
| @Get('/users/{userId}') | ||
| @Tags('Image') | ||
| @SuccessResponse('200', 'OK') | ||
| public async getImageListFromTag( | ||
| @Path() userId: string, | ||
| @Query() tag: string, | ||
| ): Promise<Response> { | ||
| const dto = new RequestTagSearch(tag, userId); | ||
| const images = await findImagesFromTag(dto).catch(err => { | ||
| if (err instanceof BaseError) { | ||
| throw err; | ||
| } else { | ||
| throw new ServerError(); | ||
| } | ||
| }); | ||
|
|
||
| return new Response(images); | ||
| } | ||
| } |
This file contains hidden or 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,45 @@ | ||
| import { | ||
| Body, | ||
| Controller, | ||
| Get, | ||
| Path, | ||
| Post, | ||
| Query, | ||
| Res, | ||
| Route, | ||
| SuccessResponse, | ||
| TsoaResponse, | ||
| Tags, | ||
| } from 'tsoa'; | ||
| import {findTagsByDate} from '../services/tsoaTag.service.js'; | ||
| import {DateToTags} from '../dtos/tsoaTag.dto.js'; | ||
| import {BaseError, ServerError, TagBadRequest} from '../errors.js'; | ||
| import {Response} from '../models/tsoaResponse.js'; | ||
|
|
||
| @Route('tags') | ||
| export class TagsController extends Controller { | ||
| @Get('/users/{userId}') | ||
| @Tags('Tag') | ||
| @SuccessResponse('200', 'OK') | ||
| public async getTagListWithDate( | ||
| @Path() userId: string, | ||
| @Query() year: number, | ||
| @Query() month: number, | ||
| @Query() date?: number, | ||
| ): Promise<Response> { | ||
| const dto = new DateToTags(userId, year, month, date); | ||
| const tags = await findTagsByDate(dto) | ||
| .then(result => { | ||
| return {tags: result}; | ||
| }) | ||
| .catch(err => { | ||
| if (!(err instanceof BaseError)) { | ||
| throw new ServerError(); | ||
| } else { | ||
| throw err; | ||
| } | ||
| }); | ||
|
|
||
| return new Response(tags); | ||
| } | ||
| } |
This file contains hidden or 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,9 @@ | ||
| export class RequestTagSearch { | ||
| tag: string; | ||
| userId: bigint; | ||
|
|
||
| constructor(tag: string, userId: string) { | ||
| this.tag = tag; | ||
| this.userId = BigInt(userId); | ||
| } | ||
| } |
This file contains hidden or 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,14 @@ | ||
| export class DateToTags { | ||
| createdAt: Date; | ||
| userId: bigint; | ||
| dateExisted: boolean = true; | ||
|
|
||
| constructor(userId: string, year: number, month: number, date?: number) { | ||
| if (!date) { | ||
| date = 1; | ||
| this.dateExisted = false; | ||
| } | ||
| this.createdAt = new Date(Date.UTC(year, month - 1, date)); | ||
| this.userId = BigInt(userId); | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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,9 @@ | ||
| export class Response { | ||
| resultType: string = 'SUCCESS'; | ||
| error = null; | ||
| success: {data: any}; | ||
|
|
||
| constructor(data: any) { | ||
| this.success = {data}; | ||
| } | ||
| } |
This file contains hidden or 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,3 @@ | ||
| export interface ResponseFromTags { | ||
| tags: string[]; | ||
| } |
This file contains hidden or 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,36 @@ | ||
| import {Image} from '@prisma/client'; | ||
| import {prisma} from '../db.config.js'; | ||
| import {DBError} from '../errors.js'; | ||
|
|
||
| export const selectImagesFromTag = async ( | ||
| tag: string, | ||
| userId: bigint, | ||
| ): Promise<Pick<Image, 'id' | 'mediaId'>[]> => { | ||
| const images = await prisma.image | ||
| .findMany({ | ||
| where: { | ||
| AND: [ | ||
| { | ||
| tags: { | ||
| some: { | ||
| tag: { | ||
| content: tag, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| userId: userId, | ||
| }, | ||
| ], | ||
| }, | ||
| select: { | ||
| id: true, | ||
| mediaId: true, | ||
| }, | ||
| }) | ||
| .catch(() => { | ||
| throw new DBError(); | ||
| }); | ||
| return images; | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 tag 부분의 dto를 간단하게 썼는데 class 사용해서 만드셨네요. 혹시 이유가 있을까요?