npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cocrepo/dto

v0.1.11

Published

DTO 클래스 패키지

Readme

@cocrepo/dto

NestJS 애플리케이션을 위한 Data Transfer Objects (DTO) 패키지입니다.

설치

pnpm add @cocrepo/dto

주요 기능

DTO 구조

이 패키지는 CRUD 작업별로 DTO를 구성합니다:

  • 기본 DTO: 엔티티의 응답 형태
  • Create DTO: 생성 요청
  • Update DTO: 수정 요청
  • Query DTO: 조회/필터링 요청

사용 예시

기본 DTO 사용

import { UserDto, TenantDto, SpaceDto } from '@cocrepo/dto';

// 응답 타입으로 사용
function getUser(): UserDto {
  return {
    id: 'uuid',
    email: '[email protected]',
    name: '홍길동',
    // ...
  };
}

Create DTO 사용

import { CreateUserDto, CreateTenantDto, CreateSpaceDto } from '@cocrepo/dto';

// 생성 요청 타입
@Post('users')
createUser(@Body() dto: CreateUserDto) {
  // dto.email, dto.password, dto.name 등
}

Update DTO 사용

import { UpdateUserDto, UpdateTenantDto, UpdateSpaceDto } from '@cocrepo/dto';

// 수정 요청 타입 (모든 필드가 선택적)
@Patch('users/:id')
updateUser(@Param('id') id: string, @Body() dto: UpdateUserDto) {
  // dto.email?, dto.name? 등
}

Query DTO 사용

import { QueryUserDto, QueryTenantDto, QuerySpaceDto } from '@cocrepo/dto';

// 조회/필터링 요청 타입
@Get('users')
getUsers(@Query() query: QueryUserDto) {
  // query.page, query.limit, query.search 등
}

제공 DTO 목록

인증 (Auth)

| DTO | 설명 | |-----|------| | LoginPayloadDto | 로그인 요청 | | SignUpPayloadDto | 회원가입 요청 | | TokenDto | 토큰 응답 |

사용자/조직

| 엔티티 | 기본 | Create | Update | Query | |--------|------|--------|--------|-------| | User | UserDto | CreateUserDto | UpdateUserDto | QueryUserDto | | Tenant | TenantDto | CreateTenantDto | UpdateTenantDto | QueryTenantDto | | Space | SpaceDto | CreateSpaceDto | UpdateSpaceDto | QuerySpaceDto | | Role | RoleDto | CreateRoleDto | UpdateRoleDto | QueryRoleDto | | Group | GroupDto | CreateGroupDto | UpdateGroupDto | QueryGroupDto |

콘텐츠

| 엔티티 | 기본 | Create | Update | Query | |--------|------|--------|--------|-------| | Category | CategoryDto | CreateCategoryDto | UpdateCategoryDto | QueryCategoryDto | | Exercise | ExerciseDto | CreateExerciseDto | UpdateExerciseDto | QueryExerciseDto | | Program | ProgramDto | CreateProgramDto | UpdateProgramDto | QueryProgramDto | | Routine | RoutineDto | CreateRoutineDto | UpdateRoutineDto | QueryRoutineDto | | Subject | SubjectDto | CreateSubjectDto | UpdateSubjectDto | QuerySubjectDto |

일정

| 엔티티 | 기본 | Create | Update | Query | |--------|------|--------|--------|-------| | Timeline | TimelineDto | CreateTimelineDto | UpdateTimelineDto | QueryTimelineDto | | Session | SessionDto | CreateSessionDto | UpdateSessionDto | QuerySessionDto | | Ground | GroundDto | CreateGroundDto | UpdateGroundDto | QueryGroundDto |

파일

| 엔티티 | 기본 | Create | Update | Query | |--------|------|--------|--------|-------| | File | FileDto | CreateFileDto | UpdateFileDto | QueryFileDto | | FileAssociation | FileAssociationDto | CreateFileAssociationDto | - | QueryFileAssociationDto | | FileClassification | FileClassificationDto | CreateFileClassificationDto | UpdateFileClassificationDto | QueryFileClassificationDto |

연관/분류

| 엔티티 | 기본 | Create | Update | Query | |--------|------|--------|--------|-------| | UserAssociation | UserAssociationDto | CreateUserAssociationDto | - | QueryUserAssociationDto | | SpaceAssociation | SpaceAssociationDto | CreateSpaceAssociationDto | - | QuerySpaceAssociationDto | | RoleAssociation | RoleAssociationDto | CreateRoleAssociationDto | - | QueryRoleAssociationDto |


파일 구조

src/
├── auth/                    # 인증 관련 DTO
│   ├── login-payload.dto.ts
│   ├── sign-up-payload.dto.ts
│   ├── token.dto.ts
│   └── index.ts
├── create/                  # 생성 DTO
│   ├── create-user.dto.ts
│   ├── create-tenant.dto.ts
│   └── ...
├── update/                  # 수정 DTO
│   ├── update-user.dto.ts
│   ├── update-tenant.dto.ts
│   └── ...
├── query/                   # 조회 DTO
│   ├── query-user.dto.ts
│   ├── page-meta.dto.ts
│   ├── order-by.dto.ts
│   └── ...
├── abstract.dto.ts          # 추상 DTO
├── user.dto.ts              # 기본 DTO
├── tenant.dto.ts
└── index.ts

페이지네이션

쿼리 DTO는 공통 페이지네이션 옵션을 포함합니다:

import { QueryUserDto } from '@cocrepo/dto';

// 쿼리 파라미터
const query: QueryUserDto = {
  page: 1,
  limit: 20,
  orderBy: 'createdAt',
  order: 'desc',
  search: '홍길동',
};

의존성

  • @cocrepo/constant - 상수
  • @cocrepo/decorator - 필드 데코레이터
  • @cocrepo/entity - 엔티티 타입
  • @cocrepo/enum - 열거형
  • @cocrepo/toolkit - 유틸리티
  • @nestjs/common (peer)
  • @nestjs/swagger (peer)
  • class-validator (peer)
  • class-transformer (peer)