Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f2ead261c8 | |||
| 1ad95ff7e8 |
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
Injectable,
|
||||
Logger,
|
||||
NotFoundException,
|
||||
type OnModuleInit,
|
||||
} from '@nestjs/common';
|
||||
import { Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { LessThanOrEqual, MoreThanOrEqual, Repository } from 'typeorm';
|
||||
import { User } from '../user/entities/user.entity';
|
||||
@@ -41,27 +36,10 @@ export interface ScheduleEventResponse {
|
||||
createdById: string | null;
|
||||
}
|
||||
|
||||
// 기본 카테고리 시드 — 최초 1회만 적재(테이블 비어있을 때). label/color/순서.
|
||||
const DEFAULT_CATEGORIES: { label: string; color: string }[] = [
|
||||
{ label: '회의', color: '#1d4ed8' },
|
||||
{ label: '외부 미팅', color: '#0284c7' },
|
||||
{ label: '채용·면접', color: '#be185d' },
|
||||
{ label: '사내 행사', color: '#4f46e5' },
|
||||
{ label: '교육·세미나', color: '#1f9d57' },
|
||||
{ label: '휴가·부재', color: '#b7791f' },
|
||||
{ label: '회식·모임', color: '#9333ea' },
|
||||
{ label: '마감·릴리스', color: '#dc2626' },
|
||||
{ label: '리뷰·QA', color: '#0d9488' },
|
||||
{ label: '재무·결산', color: '#475569' },
|
||||
{ label: '홍보·PR', color: '#ea580c' },
|
||||
{ label: '기타', color: '#0e9594' },
|
||||
];
|
||||
|
||||
// 일정(전사 공유 캘린더) 비즈니스 로직 — 카테고리/일정 CRUD + 참석자 매핑.
|
||||
// (기본 카테고리 시드 없음 — 카테고리는 사용자가 직접 추가한다)
|
||||
@Injectable()
|
||||
export class ScheduleService implements OnModuleInit {
|
||||
private readonly logger = new Logger(ScheduleService.name);
|
||||
|
||||
export class ScheduleService {
|
||||
constructor(
|
||||
@InjectRepository(ScheduleCategory)
|
||||
private readonly categoryRepo: Repository<ScheduleCategory>,
|
||||
@@ -70,21 +48,6 @@ export class ScheduleService implements OnModuleInit {
|
||||
private readonly userService: UserService,
|
||||
) {}
|
||||
|
||||
// 기동 시 기본 카테고리 시드(멱등) — 비어있을 때만 적재. dev/prod 공통.
|
||||
async onModuleInit(): Promise<void> {
|
||||
const count = await this.categoryRepo.count();
|
||||
if (count > 0) return;
|
||||
const rows = DEFAULT_CATEGORIES.map((c, i) =>
|
||||
this.categoryRepo.create({
|
||||
label: c.label,
|
||||
color: c.color,
|
||||
sortOrder: i,
|
||||
}),
|
||||
);
|
||||
await this.categoryRepo.save(rows);
|
||||
this.logger.log(`기본 일정 카테고리 ${rows.length}건 시드`);
|
||||
}
|
||||
|
||||
// ----- 카테고리 -----
|
||||
|
||||
async listCategories(): Promise<ScheduleCategoryResponse[]> {
|
||||
|
||||
Reference in New Issue
Block a user