Skip to content

Commit

Permalink
Merge pull request #1263 from academic-relations/dev
Browse files Browse the repository at this point in the history
활동보고서 작성 기능 & 대표자 변경 기능 배포
  • Loading branch information
Engineer-JJHaMa authored Dec 21, 2024
2 parents e1b55a6 + 10c02d2 commit 9358a60
Show file tree
Hide file tree
Showing 90 changed files with 12,929 additions and 9,256 deletions.
4 changes: 2 additions & 2 deletions .docker/dockerfile/api.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

# Base image with node + pnpm
# TODO: bump pnpm to 9 (must change 'engine' field in package.json)
FROM node:20-slim AS base
FROM node:22-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN corepack prepare pnpm@8.15.8 --activate
RUN corepack prepare pnpm@9.14.4 --activate
WORKDIR /app

# Build to output .next build directory
Expand Down
4 changes: 2 additions & 2 deletions .docker/dockerfile/web.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

# Base image with node + pnpm
# TODO: bump pnpm to 9 (must change 'engine' field in package.json)
FROM node:20-slim AS base
FROM node:22-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN corepack prepare pnpm@8.15.8 --activate
RUN corepack prepare pnpm@9.14.4 --activate
WORKDIR /app

# Build to output .next build directory
Expand Down
4 changes: 2 additions & 2 deletions .docker/dockerfile/web.bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

# Base image with node + pnpm
# TODO: bump pnpm to 9 (must change 'engine' field in package.json)
FROM node:20-slim AS base
FROM node:22-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN corepack prepare pnpm@8.15.8 --activate
RUN corepack prepare pnpm@9.14.4 --activate
WORKDIR /app

# Build to output .next build directory
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cd-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
jobs:
publish-docker-image:
name: "Build and Publish Latest Docker Image"
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

strategy:
fail-fast: true
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
deploy-production-image:
name: "Deploy Latest Staging Docker Image to Server"
needs: [publish-docker-image]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: "Image push via webhook"
uses: distributhor/workflow-webhook@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cd-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
jobs:
publish-docker-image:
name: "Build and Publish Latest Docker Image"
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

strategy:
fail-fast: true
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
deploy-production-image:
name: "Deploy Latest Staging Docker Image to Server"
needs: [publish-docker-image]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: "Image push via webhook"
uses: distributhor/workflow-webhook@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ on:
jobs:
lint-and-format:
name: Lint and Format
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

strategy:
matrix:
node-version: [20.x]
node-version: [22.12.0]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
pnpm-version: [8.15.8]
pnpm-version: [9.14.4]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.9.0
v22.12.0
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"typescript": "^5.1.6"
},
"engines": {
"node": "^20.9.0",
"pnpm": "^8.15.8"
"node": "^22.12.0",
"pnpm": "^9.14.4"
},
"packageManager": "pnpm@8.15.8"
"packageManager": "pnpm@9.14.4"
}
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@
"coverageDirectory": "../coverage",
"testEnvironment": "node"
},
"packageManager": "pnpm@8.15.8"
"packageManager": "pnpm@9.14.4"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Body, Controller, Get, Param, UsePipes } from "@nestjs/common";
import { Controller, Get, Param, Query, UsePipes } from "@nestjs/common";

import apiAct006 from "@sparcs-clubs/interface/api/activity/endpoint/apiAct006";
import apiAct009 from "@sparcs-clubs/interface/api/activity/endpoint/apiAct009";
Expand All @@ -12,12 +12,12 @@ import { GetStudent } from "@sparcs-clubs/api/common/util/decorators/param-decor
import ActivityActivityTermService from "../service/activity.activity-term.service";

import type {
ApiAct006RequestBody,
ApiAct006RequestParam,
ApiAct006RequestQuery,
ApiAct006ResponseOk,
} from "@sparcs-clubs/interface/api/activity/endpoint/apiAct006";
import type {
ApiAct009RequestBody,
ApiAct009RequestQuery,
ApiAct009ResponseOk,
} from "@sparcs-clubs/interface/api/activity/endpoint/apiAct009";

Expand All @@ -32,11 +32,11 @@ export default class ActivityActivityTermController {
@UsePipes(new ZodPipe(apiAct009))
async getStudentActivitiesActivityTerms(
@GetStudent() user: GetStudent,
@Body() body: ApiAct009RequestBody,
@Query() query: ApiAct009RequestQuery,
): Promise<ApiAct009ResponseOk> {
const result =
await this.activityActivityTermService.getStudentActivitiesActivityTerms(
body,
query,
user.studentId,
);
return result;
Expand All @@ -48,12 +48,12 @@ export default class ActivityActivityTermController {
async getStudentActivitiesActivityTerm(
@GetStudent() user: GetStudent,
@Param() param: ApiAct006RequestParam,
@Body() body: ApiAct006RequestBody,
@Query() query: ApiAct006RequestQuery,
): Promise<ApiAct006ResponseOk> {
const result =
await this.activityActivityTermService.getStudentActivitiesActivityTerm(
param,
body,
query,
user.studentId,
);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ import apiAct014 from "@sparcs-clubs/interface/api/activity/endpoint/apiAct014";
import apiAct015 from "@sparcs-clubs/interface/api/activity/endpoint/apiAct015";
import apiAct016 from "@sparcs-clubs/interface/api/activity/endpoint/apiAct016";
import apiAct017 from "@sparcs-clubs/interface/api/activity/endpoint/apiAct017";
import apiAct018 from "@sparcs-clubs/interface/api/activity/endpoint/apiAct018";

import { ZodPipe } from "@sparcs-clubs/api/common/pipe/zod-pipe";

import {
Executive,
Professor,
Public,
Student,
} from "@sparcs-clubs/api/common/util/decorators/method-decorator";
import {
Expand Down Expand Up @@ -66,7 +68,7 @@ import type {
ApiAct004ResponseOk,
} from "@sparcs-clubs/interface/api/activity/endpoint/apiAct004";
import type {
ApiAct005RequestBody,
ApiAct005RequestQuery,
ApiAct005ResponseOk,
} from "@sparcs-clubs/interface/api/activity/endpoint/apiAct005";
import type {
Expand Down Expand Up @@ -102,6 +104,7 @@ import type {
ApiAct017RequestParam,
ApiAct017ResponseOk,
} from "@sparcs-clubs/interface/api/activity/endpoint/apiAct017";
import type { ApiAct018ResponseOk } from "@sparcs-clubs/interface/api/activity/endpoint/apiAct018";

@Controller()
export default class ActivityController {
Expand Down Expand Up @@ -129,10 +132,10 @@ export default class ActivityController {
@UsePipes(new ZodPipe(apiAct005))
async getStudentActivities(
@GetStudent() user: GetStudent,
@Body() body: ApiAct005RequestBody,
@Query() query: ApiAct005RequestQuery,
): Promise<ApiAct005ResponseOk> {
const result = await this.activityService.getStudentActivities(
body.clubId,
query.clubId,
user.studentId,
);
return result;
Expand Down Expand Up @@ -338,4 +341,12 @@ export default class ActivityController {
});
return result;
}

@Public()
@Get("/public/activities/deadline")
@UsePipes(new ZodPipe(apiAct018))
async getPublicActivitiesDeadline(): Promise<ApiAct018ResponseOk> {
const result = await this.activityService.getPublicActivitiesDeadline();
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import ActivityRepository from "../repository/activity.repository";

import type {
ApiAct006RequestParam,
ApiAct006RequestQuery,
ApiAct006ResponseOk,
} from "@sparcs-clubs/interface/api/activity/endpoint/apiAct006";
import type {
ApiAct009RequestBody,
ApiAct009RequestQuery,
ApiAct009ResponseOk,
} from "@sparcs-clubs/interface/api/activity/endpoint/apiAct009";

Expand Down Expand Up @@ -72,14 +73,14 @@ export default class ActivityActivityTermService {

async getStudentActivitiesActivityTerm(
param: ApiAct006RequestParam,
body: ApiAct009RequestBody,
query: ApiAct006RequestQuery,
studentId: number,
): Promise<ApiAct006ResponseOk> {
// 요청한 학생이 동아리의 대표자인지 확인합니다.
await this.checkIsStudentDelegate({ studentId, clubId: body.clubId });
await this.checkIsStudentDelegate({ studentId, clubId: query.clubId });
const activities =
await this.activityRepository.selectActivityByClubIdAndActivityDId(
body.clubId,
query.clubId,
param.activityTermId,
);
const result = await Promise.all(
Expand Down Expand Up @@ -107,15 +108,16 @@ export default class ActivityActivityTermService {
}

async getStudentActivitiesActivityTerms(
body: ApiAct009RequestBody,
query: ApiAct009RequestQuery,
studentId: number,
): Promise<ApiAct009ResponseOk> {
// 요청한 학생이 동아리의 대표자인지 확인합니다.
await this.checkIsStudentDelegate({ studentId, clubId: body.clubId });
await this.checkIsStudentDelegate({ studentId, clubId: query.clubId });
// 해당 동아리가 등록되었던 학기 정보를 가져오고, startTerm과 endTerm에 대응되는 활동기간을 조회합니다.
const semesters = await this.clubPublicService.getClubsExistedSemesters({
clubId: body.clubId,
clubId: query.clubId,
});
console.log("asdfAsdf", semesters);
const activityTerms: ApiAct009ResponseOk["terms"] = [];
await Promise.all(
semesters.map(async semester => {
Expand Down
31 changes: 31 additions & 0 deletions packages/api/src/feature/activity/service/activity.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import type {
ApiAct017RequestParam,
ApiAct017ResponseOk,
} from "@sparcs-clubs/interface/api/activity/endpoint/apiAct017";
import type { ApiAct018ResponseOk } from "@sparcs-clubs/interface/api/activity/endpoint/apiAct018";

@Injectable()
export default class ActivityService {
Expand Down Expand Up @@ -311,6 +312,7 @@ export default class ActivityService {
content: e.comment,
createdAt: e.createdAt,
})),
updatedAt: activity.updatedAt,
};
}

Expand Down Expand Up @@ -739,6 +741,7 @@ export default class ActivityService {
content: e.comment,
createdAt: e.createdAt,
})),
updatedAt: activity.updatedAt,
};
}

Expand Down Expand Up @@ -793,6 +796,7 @@ export default class ActivityService {
content: e.comment,
createdAt: e.createdAt,
})),
updatedAt: activity.updatedAt,
};
}

Expand Down Expand Up @@ -842,4 +846,31 @@ export default class ActivityService {

return {};
}

/**
* @description getActivitiesDeadline의 서비스 진입점입니다.
* @returns 오늘의 활동보고서 작성기간을 리턴합니다.
*/
async getPublicActivitiesDeadline(): Promise<ApiAct018ResponseOk> {
const today = getKSTDate();
const todayDeadline = await this.activityRepository
.selectDeadlineByDate(today)
.then(arr => {
if (arr.length === 0)
throw new HttpException(
"Today is not in the range of deadline",
HttpStatus.INTERNAL_SERVER_ERROR,
);
return arr[0];
});
return {
deadline: {
activityDeadlineEnum: todayDeadline.deadlineEnumId,
duration: {
startTerm: todayDeadline.startDate,
endTerm: todayDeadline.endDate,
},
},
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export class AuthController {
expires: token.accessTokenTokenExpiresAt,
httpOnly: false,
});
logger.debug(`Redirecting to ${next}`);
return res.redirect(next);
}

Expand Down
Loading

0 comments on commit 9358a60

Please sign in to comment.