Skip to content

Commit

Permalink
Merge pull request #1139 from academic-relations/dev
Browse files Browse the repository at this point in the history
Merge dev into main
  • Loading branch information
pbc1017 authored Oct 7, 2024
2 parents 0af17ff + b57a7b6 commit 0369a88
Show file tree
Hide file tree
Showing 89 changed files with 3,511 additions and 2,307 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default class ActivityController {
): Promise<ApiAct002ResponseOk> {
const result = await this.activityService.getStudentActivity(
param.activityId,
user.studentId,
// user.studentId,
);

return result;
Expand Down
12 changes: 6 additions & 6 deletions packages/api/src/feature/activity/service/activity.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,12 @@ export default class ActivityService {

async getStudentActivity(
activityId: number,
studentId: number,
// studentId: number,
): Promise<ApiAct002ResponseOk> {
const activity = await this.getActivity({ activityId });

// 학생이 동아리 대표자 또는 대의원이 맞는지 확인합니다.
await this.checkIsStudentDelegate({ studentId, clubId: activity.clubId });
// await this.checkIsStudentDelegate({ studentId, clubId: activity.clubId });

const evidence = await this.activityRepository.selectFileByActivityId(
activity.id,
Expand Down Expand Up @@ -654,10 +654,10 @@ export default class ActivityService {
query: ApiAct011RequestQuery;
}): Promise<ApiAct011ResponseOk> {
// 해당 학생이 동아리 대표자가 맞는지 검사합니다.
await this.checkIsStudentDelegate({
studentId: param.studentId,
clubId: param.query.clubId,
});
// await this.checkIsStudentDelegate({
// studentId: param.studentId,
// clubId: param.query.clubId,
// });
const activities = await this.getProvisionalActivities({
clubId: param.query.clubId,
});
Expand Down
29 changes: 20 additions & 9 deletions packages/api/src/feature/club/delegate/delegate.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,11 @@ export default class ClubDelegateService {

// targetStudent가 현재 대표자로 활동 중인지 검사합니다.
const targetStatus =
await this.clubDelegateDRepository.findDelegateByStudentId(
param.targetStudentId,
);
param.targetStudentId !== 0
? await this.clubDelegateDRepository.findDelegateByStudentId(
param.targetStudentId,
)
: [];
if (targetStatus.length > 1)
throw new HttpException("unreachable", HttpStatus.INTERNAL_SERVER_ERROR);
if (targetStatus.length === 1)
Expand All @@ -145,9 +147,13 @@ export default class ClubDelegateService {

// targetStudent가 이미 다른 요청을 받은 상태인지 검사합니다.
const targetRequests =
await this.clubDelegateDRepository.findDelegateChangeRequestByStudentId({
studentId: param.targetStudentId,
});
param.targetStudentId !== 0
? await this.clubDelegateDRepository.findDelegateChangeRequestByStudentId(
{
studentId: param.targetStudentId,
},
)
: [];
if (targetRequests.length > 1)
throw new HttpException("unreachable", HttpStatus.INTERNAL_SERVER_ERROR);
if (targetRequests.length === 1)
Expand All @@ -156,10 +162,10 @@ export default class ClubDelegateService {
HttpStatus.BAD_REQUEST,
);

// 대표자 변경 신청의 경우 targetStudentId가 undefined인지 검사합니다.
// 대표자 변경 신청의 경우 targetStudentId가 0인지 검사합니다.
if (
param.clubDelegateEnumId === ClubDelegateEnum.Representative &&
param.targetStudentId === undefined
param.targetStudentId === 0
)
throw new HttpException(
"representative can;t be empty",
Expand Down Expand Up @@ -268,12 +274,17 @@ export default class ClubDelegateService {
filterClubDelegateEnum:
param.param.delegateEnumId === ClubDelegateEnum.Representative
? [ClubDelegateEnum.Representative]
: [ClubDelegateEnum.Delegate1, ClubDelegateEnum.Delegate2],
: [
ClubDelegateEnum.Representative,
ClubDelegateEnum.Delegate1,
ClubDelegateEnum.Delegate2,
],
});

const response = {
students: result.map(e => ({
id: e.student.id,
studentNumber: String(e.student.number),
name: e.student.name,
phoneNumber: e.student.phoneNumber,
})),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export class ClubDelegateDRepository {
async updateDelegate(param: {
clubId: number;
clubDelegateEnumId: number;
studentId?: number;
studentId: number;
}): Promise<boolean> {
const now = getKSTDate();

Expand All @@ -315,6 +315,8 @@ export class ClubDelegateDRepository {
return false;
}

if (param.studentId === 0) return true;

const [delegateInsertResult] = await tx.insert(ClubDelegateD).values({
clubId: param.clubId,
studentId: param.studentId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ import apiReg018, {
} from "@sparcs-clubs/interface/api/registration/endpoint/apiReg018";
import apiReg022 from "@sparcs-clubs/interface/api/registration/endpoint/apiReg022";
import apiReg023 from "@sparcs-clubs/interface/api/registration/endpoint/apiReg023";
import apiReg024, {
ApiReg024RequestQuery,
ApiReg024ResponseOk,
} from "@sparcs-clubs/interface/api/registration/endpoint/apiReg024";

import { ZodPipe } from "@sparcs-clubs/api/common/pipe/zod-pipe";
import {
Expand Down Expand Up @@ -327,4 +331,18 @@ export class ClubRegistrationController {
);
return result;
}

@Student()
@Get("/student/registrations/club-registrations")
@UsePipes(new ZodPipe(apiReg024))
async getStudentRegistrationsClubRegistrations(
@Query() query: ApiReg024RequestQuery,
): Promise<ApiReg024ResponseOk> {
const result =
await this.clubRegistrationService.getStudentRegistrationsClubRegistrations(
query.pageOffset,
query.itemCount,
);
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,12 @@ export class ClubRegistrationRepository {
StudentT,
and(
eq(Student.id, StudentT.studentId),
lte(StudentT.startTerm, cur),
or(gte(StudentT.endTerm, cur), isNull(StudentT.endTerm)),
// lte(StudentT.startTerm, cur),
// or(gte(StudentT.endTerm, cur), isNull(StudentT.endTerm)),
isNull(StudentT.deletedAt),
),
)
.where(and(isNull(Student.deletedAt), eq(Student.id, studentId)))
.where(isNull(Student.deletedAt))
.as("representative");

const File1 = alias(File, "File1");
Expand Down Expand Up @@ -580,7 +580,7 @@ export class ClubRegistrationRepository {
return { registrations: result };
}

async getExecutiveRegistrationsClubRegistrations(
async getRegistrationsClubRegistrations(
pageOffset: number,
itemCount: number,
): Promise<ApiReg014ResponseOk> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import type {
ApiReg023RequestParam,
ApiReg023ResponseOk,
} from "@sparcs-clubs/interface/api/registration/endpoint/apiReg023";
import type { ApiReg024ResponseOk } from "@sparcs-clubs/interface/api/registration/endpoint/apiReg024";

@Injectable()
export class ClubRegistrationService {
Expand Down Expand Up @@ -353,13 +354,13 @@ export class ClubRegistrationService {
applyId: number,
): Promise<ApiReg011ResponseOk> {
// 동아리 신청, 집행부원 피드백, 동아리 수정 기간인지 확인합니다.
await this.clubRegistrationPublicService.checkDeadline({
enums: [
RegistrationDeadlineEnum.ClubRegistrationApplication,
// RegistrationDeadlineEnum.ClubRegistrationModification,
// RegistrationDeadlineEnum.ClubRegistrationExecutiveFeedback,
],
});
// await this.clubRegistrationPublicService.checkDeadline({
// enums: [
// RegistrationDeadlineEnum.ClubRegistrationApplication,
// // RegistrationDeadlineEnum.ClubRegistrationModification,
// // RegistrationDeadlineEnum.ClubRegistrationExecutiveFeedback,
// ],
// });
const result =
await this.clubRegistrationRepository.getStudentRegistrationsClubRegistration(
studentId,
Expand Down Expand Up @@ -391,13 +392,13 @@ export class ClubRegistrationService {
studentId: number,
): Promise<ApiReg012ResponseOk> {
// 동아리 신청, 집행부원 피드백, 동아리 수정 기간인지 확인합니다.
await this.clubRegistrationPublicService.checkDeadline({
enums: [
RegistrationDeadlineEnum.ClubRegistrationApplication,
// RegistrationDeadlineEnum.ClubRegistrationModification,
// RegistrationDeadlineEnum.ClubRegistrationExecutiveFeedback,
],
});
// await this.clubRegistrationPublicService.checkDeadline({
// enums: [
// RegistrationDeadlineEnum.ClubRegistrationApplication,
// // RegistrationDeadlineEnum.ClubRegistrationModification,
// // RegistrationDeadlineEnum.ClubRegistrationExecutiveFeedback,
// ],
// });
const result =
await this.clubRegistrationRepository.getStudentRegistrationsClubRegistrationsMy(
studentId,
Expand All @@ -410,7 +411,19 @@ export class ClubRegistrationService {
itemCount: number,
): Promise<ApiReg014ResponseOk> {
const result =
await this.clubRegistrationRepository.getExecutiveRegistrationsClubRegistrations(
await this.clubRegistrationRepository.getRegistrationsClubRegistrations(
pageOffset,
itemCount,
);
return result;
}

async getStudentRegistrationsClubRegistrations(
pageOffset: number,
itemCount: number,
): Promise<ApiReg024ResponseOk> {
const result =
await this.clubRegistrationRepository.getRegistrationsClubRegistrations(
pageOffset,
itemCount,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ export class MemberRegistrationService {
async getStudentRegistrationsMemberRegistrationsMy(
studentId: number,
): Promise<ApiReg006ResponseType> {
const ismemberRegistrationEvent =
await this.memberRegistrationRepository.isMemberRegistrationEvent();
if (!ismemberRegistrationEvent)
return { status: HttpStatus.NO_CONTENT, data: { applies: [] } };
// const ismemberRegistrationEvent =
// await this.memberRegistrationRepository.isMemberRegistrationEvent();
// if (!ismemberRegistrationEvent)
// return { status: HttpStatus.NO_CONTENT, data: { applies: [] } };
const result =
await this.memberRegistrationRepository.getStudentRegistrationsMemberRegistrationsMy(
studentId,
Expand Down
2 changes: 1 addition & 1 deletion packages/interface/src/api/club/endpoint/apiClb007.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const requestParam = z.object({
const requestQuery = z.object({});

const requestBody = z.object({
studentId: z.coerce.number().int().min(1),
studentId: z.coerce.number().int().min(0), // studentId로 0이 넘어오면 해당 지위를 비워둡니다.
delegateEnumId: z.nativeEnum(ClubDelegateEnum),
});

Expand Down
3 changes: 2 additions & 1 deletion packages/interface/src/api/club/endpoint/apiClb008.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ const responseBodyMap = {
students: z.array(
z.object({
id: z.coerce.number().int(),
name: z.coerce.string().max(20),
studentNumber: z.string(),
name: z.coerce.string().max(20), // studentNumber는 string으로 통일!
phoneNumber: zKrPhoneNumber,
}),
),
Expand Down
75 changes: 75 additions & 0 deletions packages/interface/src/api/registration/endpoint/apiReg024.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { HttpStatusCode } from "axios";

import { z } from "zod";

import { zClubName } from "@sparcs-clubs/interface/common/commonString";
import {
RegistrationStatusEnum,
RegistrationTypeEnum,
} from "@sparcs-clubs/interface/common/enum/registration.enum";

/**
* @version v0.1
* @description 집행부원이 이번 학기 동아리 등록 신청서 목록을 조회합니다.
*/

const url = () => `/student/registrations/club-registrations`;
const method = "GET";

const requestParam = z.object({});

const requestQuery = z.object({
pageOffset: z.coerce.number().int().min(1),
itemCount: z.coerce.number().int().min(1),
});

const requestBody = z.object({});

const responseBodyMap = {
[HttpStatusCode.Ok]: z.object({
items: z.array(
z.object({
id: z.coerce.number().int().min(1),
registrationTypeEnumId: z.nativeEnum(RegistrationTypeEnum),
registrationStatusEnumId: z.nativeEnum(RegistrationStatusEnum),
divisionId: z.coerce.number().int().min(1),
clubNameKr: zClubName.optional(),
newClubNameKr: zClubName,
clubNameEm: zClubName.optional(),
newClubNameEn: zClubName,
representativeName: z.string(),
activityFieldKr: z.string().max(255),
activityFieldEn: z.string().max(255),
professorName: z.string().optional(),
}),
),
total: z.coerce.number().int().min(1),
offset: z.coerce.number().int().min(1),
}),
};

const responseErrorMap = {};

const apiReg024 = {
url,
method,
requestParam,
requestQuery,
requestBody,
responseBodyMap,
responseErrorMap,
};

type ApiReg024RequestParam = z.infer<typeof apiReg024.requestParam>;
type ApiReg024RequestQuery = z.infer<typeof apiReg024.requestQuery>;
type ApiReg024RequestBody = z.infer<typeof apiReg024.requestBody>;
type ApiReg024ResponseOk = z.infer<(typeof apiReg024.responseBodyMap)[200]>;

export default apiReg024;

export type {
ApiReg024RequestParam,
ApiReg024RequestQuery,
ApiReg024RequestBody,
ApiReg024ResponseOk,
};
14 changes: 3 additions & 11 deletions packages/web/src/app/activity-certificate/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@

import React from "react";

// 배포용 not found 페이지 (시작)
import NotFound from "../not-found";
import ActivityCertificateMainFrame from "@sparcs-clubs/web/features/activity-certificate/frames/ActivityCertificateMainFrame";

const TemporaryNotFound = () => <NotFound />;
const ActivityCertificate = () => <ActivityCertificateMainFrame />;

export default TemporaryNotFound;
// 배포용 not found 페이지 (끝)

// import ActivityCertificateMainFrame from "@sparcs-clubs/web/features/activity-certificate/frames/ActivityCertificateMainFrame";

// const Clubs = () => <ActivityCertificateMainFrame />;

// export default Clubs;
export default ActivityCertificate;
14 changes: 3 additions & 11 deletions packages/web/src/app/common-space/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@

import React from "react";

// 배포용 not found 페이지 (시작)
import NotFound from "../not-found";
import CommonSpaceMainFrame from "@sparcs-clubs/web/features/common-space/frames/CommonSpaceMainFrame";

const TemporaryNotFound = () => <NotFound />;
const CommonSpaceBusiness = () => <CommonSpaceMainFrame />;

export default TemporaryNotFound;
// 배포용 not found 페이지 (끝)

// import CommonSpaceMainFrame from "@sparcs-clubs/web/features/common-space/frames/CommonSpaceMainFrame";

// const CommonSpaceBusiness = () => <CommonSpaceMainFrame />;

// export default CommonSpaceBusiness;
export default CommonSpaceBusiness;
Loading

0 comments on commit 0369a88

Please sign in to comment.