只是想知道将NestJS实体对象转换为DTO的最佳方法.
可以说我有以下内容:
import { IsString, IsNumber, IsBoolean } from 'class-validator';
import { Exclude } from 'class-transformer';
export class PhotoSnippetDto {
@IsNumber()
readonly id: number;
@IsString()
readonly name: string;
constructor(props) {
Object.assign(this, props);
}
}
export class Photo {
@IsNumber()
id: number;
@IsString()
name: string;
@IsString()
description: string;
@IsString()
filename: string;
@IsNumber()
views: number;
@IsBoolean()
isPublished: boolean;
@Exclude()
@IsString()
excludedPropery: string;
constructor(props) {
Object.assign(this, props);
}
}
@Controller()
export class AppController {
@Get()
@UseInterceptors(ClassSerializerInterceptor)
root(): PhotoSnippetDto {
const photo = new …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Gitlab-runner和docker在本地运行我的Gitlab CI,然后再承诺确保它们可以正常工作。但是我有一些奇怪的问题!
不幸的是,我别无选择,只能使用Windows(过去在Linux上取得了成功)。
每次我在Powershell中运行工作时:
C:/Gitlab-runner/gitlab-runner exec docker npm
我收到一个错误:
Job failed (system failure): Error response from daemon: invalid volume specification: '/host_mnt/c/builds/project-0/Users/Lewsmith/api:C:/Users/Lewsmith/api:ro' (executor_docker.go:921:0s)
我试过设置docker卷(多种组合)和builds-dir:
C:/Gitlab-runner/gitlab-runner exec docker --builds-dir /builds --docker-privileged --docker-volumes "/builds:C:/Gitlab-runner/builds" npm
Error response from daemon: invalid mode: /Gitlab-runner/builds
由于C.之后的冒号而导致失败。
当我感到困惑时,有人能指出我正确的方向吗?
使用gitlab-runner版本11.5.0