-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement a usage-order selection of common spaces #674
Open
Hello4545
wants to merge
1
commit into
dev
Choose a base branch
from
604-impl-usage-order-cms-008
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { HttpException, HttpStatus, Injectable } from "@nestjs/common"; | ||
|
||
import logger from "@sparcs-clubs/api/common/util/logger"; | ||
|
||
import { getKSTDate, isEmptyObject } from "@sparcs-clubs/api/common/util/util"; | ||
import ClubStudentTRepository from "@sparcs-clubs/api/feature/club/repository/club.club-student-t.repository"; | ||
|
||
|
@@ -25,6 +27,7 @@ import type { ApiCms004ResponseOK } from "@sparcs-clubs/interface/api/common-spa | |
import type { ApiCms005ResponseCreated } from "@sparcs-clubs/interface/api/common-space/endpoint/apiCms005"; | ||
import type { ApiCms006ResponseOk } from "@sparcs-clubs/interface/api/common-space/endpoint/apiCms006"; | ||
import type { ApiCms007ResponseOk } from "@sparcs-clubs/interface/api/common-space/endpoint/apiCms007"; | ||
import type { ApiCms008ResponseOk } from "@sparcs-clubs/interface/api/common-space/endpoint/apiCms008"; | ||
|
||
@Injectable() | ||
export class CommonSpaceService { | ||
|
@@ -237,4 +240,25 @@ export class CommonSpaceService { | |
); | ||
return result; | ||
} | ||
|
||
async getStudentCommonSpacesUsageOrderDetail( | ||
orderId: number, | ||
): Promise<ApiCms008ResponseOk> { | ||
const order = | ||
await this.commonSpaceUsageOrderDRepository.findCommonSpaceUsageOrderById( | ||
orderId, | ||
); | ||
// const { id } = order; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❗ 아마 요근처에서 권한 확인이 들어가야 할 것 같네요 |
||
logger.debug(order); | ||
const result = { | ||
orderId, | ||
statusEnum: order.statusEnum, | ||
spaceName: order.spaceName, | ||
chargeStudentName: order.chargeStudentName, | ||
startTerm: order.startTerm, | ||
endTerm: order.endTerm, | ||
createdAt: order.createdAt, | ||
}; | ||
return result; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
packages/interface/src/api/common-space/endpoint/apiCms008.ts
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,59 @@ | ||
import { HttpStatusCode } from "axios"; | ||
import { z } from "zod"; | ||
|
||
import { CommonSpaceUsageOrderStatusEnum } from "@sparcs-clubs/interface/common/enum/commonSpace.enum"; | ||
|
||
/** | ||
* @version v0.1 | ||
* @description 개별 공용공간 사용신청 내역을 가져옵니다. | ||
*/ | ||
|
||
const url = (orderId: number) => | ||
`/student/common-spaces/common-space/usage-order/${orderId}`; | ||
const method = "GET"; | ||
|
||
const requestParam = z.object({ | ||
orderId: z.coerce.number().int().min(1), // orderId는 양의 정수여야 합니다. | ||
}); | ||
|
||
const requestQuery = z.object({}); | ||
|
||
const requestBody = z.object({}); | ||
|
||
const responseBodyMap = { | ||
[HttpStatusCode.Ok]: z.object({ | ||
orderId: z.number().int().min(1), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💬 Reponse는 coerce가 필요 없는지 확인이 필요합니다 |
||
statusEnum: z.nativeEnum(CommonSpaceUsageOrderStatusEnum), | ||
spaceName: z.string(), | ||
chargeStudentName: z.string().max(255), | ||
startTerm: z.coerce.date(), // Assuming startTerm is a datetime | ||
endTerm: z.coerce.date(), // Assuming endTerm is a datetime | ||
createdAt: z.coerce.date(), // Assuming createdAt is a datetime | ||
}), | ||
}; | ||
|
||
const responseErrorMap = {}; | ||
|
||
const apiCms008 = { | ||
url, | ||
method, | ||
requestParam, | ||
requestQuery, | ||
requestBody, | ||
responseBodyMap, | ||
responseErrorMap, | ||
}; | ||
|
||
type ApiCms008RequestParam = z.infer<typeof apiCms008.requestParam>; | ||
type ApiCms008RequestQuery = z.infer<typeof apiCms008.requestQuery>; | ||
type ApiCms008RequestBody = z.infer<typeof apiCms008.requestBody>; | ||
type ApiCms008ResponseOk = z.infer<(typeof apiCms008.responseBodyMap)[200]>; | ||
|
||
export default apiCms008; | ||
|
||
export type { | ||
ApiCms008RequestParam, | ||
ApiCms008RequestQuery, | ||
ApiCms008RequestBody, | ||
ApiCms008ResponseOk, | ||
}; |
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.
❗ CMS-008은 사용자가 해당 신청의 신청자이거나 신청 동아리의 대표자+대의원인지 검사합니다. 이를 위해 토큰으로부터 유저 정보를 가져와야해요. GetStudent의 사용 예시를 보고 적용해주세요