How to use the class-validator.IsString function in class-validator

To help you get started, we’ve selected a few class-validator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github notadd / next / packages / setting / entities / setting.entity.js View on Github external
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const typeorm_1 = require("typeorm");
const class_validator_1 = require("class-validator");
let Setting = class Setting {
};
__decorate([
    typeorm_1.PrimaryColumn({
        length: 500,
    }),
    class_validator_1.IsString(),
    __metadata("design:type", String)
], Setting.prototype, "key", void 0);
__decorate([
    typeorm_1.Column({
        type: "text",
    }),
    class_validator_1.IsString(),
    __metadata("design:type", String)
], Setting.prototype, "value", void 0);
__decorate([
    typeorm_1.CreateDateColumn(),
    __metadata("design:type", String)
], Setting.prototype, "createdAt", void 0);
__decorate([
    typeorm_1.UpdateDateColumn(),
    __metadata("design:type", String)
github vellengs / nestx / packages / server / dist / auth / dto / login.dto.js View on Github external
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const class_validator_1 = require("class-validator");
class LoginReq {
}
__decorate([
    class_validator_1.IsNotEmpty(),
    class_validator_1.IsString(),
    __metadata("design:type", String)
], LoginReq.prototype, "username", void 0);
__decorate([
    class_validator_1.IsOptional(),
    __metadata("design:type", String)
], LoginReq.prototype, "type", void 0);
__decorate([
    class_validator_1.IsNotEmpty(),
    class_validator_1.MinLength(5, {
        message: 'Your password is too short! It must be 5 characters or more!',
    }),
    __metadata("design:type", String)
], LoginReq.prototype, "password", void 0);
exports.LoginReq = LoginReq;
class LoginRes {
}
github vellengs / nestx / packages / server / dist / core / dto / user.dto.js View on Github external
class_validator_1.IsOptional(),
    __metadata("design:type", Array)
], EditProfileReq.prototype, "roles", void 0);
__decorate([
    class_validator_1.IsEmail(),
    class_validator_1.IsOptional(),
    __metadata("design:type", String)
], EditProfileReq.prototype, "email", void 0);
__decorate([
    class_validator_1.IsOptional(),
    class_validator_1.IsString(),
    __metadata("design:type", String)
], EditProfileReq.prototype, "company", void 0);
__decorate([
    class_validator_1.IsOptional(),
    class_validator_1.IsString(),
    __metadata("design:type", String)
], EditProfileReq.prototype, "siteUrl", void 0);
__decorate([
    class_validator_1.IsOptional(),
    class_validator_1.IsString(),
    __metadata("design:type", String)
], EditProfileReq.prototype, "address", void 0);
exports.EditProfileReq = EditProfileReq;
class EditUserReq {
}
__decorate([
    class_validator_1.IsString(),
    __metadata("design:type", String)
], EditUserReq.prototype, "id", void 0);
__decorate([
    class_validator_1.IsString(),
github nestjsx / crud / dist / dto / restful-params.dto.js View on Github external
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const class_validator_1 = require("class-validator");
const class_transformer_1 = require("class-transformer");
const filter_param_dto_1 = require("./filter-param.dto");
const sort_param_dto_1 = require("./sort-param.dto");
const join_param_dto_1 = require("./join-param.dto");
class RestfulParamsDto {
}
__decorate([
    class_validator_1.IsOptional(),
    class_validator_1.IsString({ each: true }),
    __metadata("design:type", Array)
], RestfulParamsDto.prototype, "fields", void 0);
__decorate([
    class_validator_1.IsOptional(),
    class_validator_1.ValidateNested({ each: true }),
    class_transformer_1.Type((t) => filter_param_dto_1.FilterParamDto),
    __metadata("design:type", Array)
], RestfulParamsDto.prototype, "filter", void 0);
__decorate([
    class_validator_1.IsOptional(),
    class_validator_1.ValidateNested({ each: true }),
    class_transformer_1.Type((t) => filter_param_dto_1.FilterParamDto),
    __metadata("design:type", Array)
], RestfulParamsDto.prototype, "or", void 0);
__decorate([
    class_validator_1.IsOptional(),
github notadd / next / packages / authentication / dtos / auth.dto.js View on Github external
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const class_validator_1 = require("class-validator");
class AuthDto {
}
__decorate([
    class_validator_1.IsString(),
    __metadata("design:type", String)
], AuthDto.prototype, "username", void 0);
__decorate([
    class_validator_1.IsString(),
    __metadata("design:type", String)
], AuthDto.prototype, "password", void 0);
exports.AuthDto = AuthDto;

//# sourceMappingURL=auth.dto.js.map
github vellengs / nestx / packages / server / dist / core / dto / menu.dto.js View on Github external
class_validator_1.IsBoolean(),
    __metadata("design:type", Boolean)
], CreateMenuReq.prototype, "enable", void 0);
__decorate([
    class_validator_1.IsOptional(),
    class_validator_1.IsBoolean(),
    __metadata("design:type", Boolean)
], CreateMenuReq.prototype, "expanded", void 0);
__decorate([
    class_validator_1.IsOptional(),
    class_validator_1.IsString(),
    __metadata("design:type", String)
], CreateMenuReq.prototype, "acl", void 0);
__decorate([
    class_validator_1.IsOptional(),
    class_validator_1.IsString(),
    __metadata("design:type", String)
], CreateMenuReq.prototype, "parent", void 0);
__decorate([
    class_validator_1.IsOptional(),
    class_validator_1.IsArray(),
    __metadata("design:type", Array)
], CreateMenuReq.prototype, "permissions", void 0);
__decorate([
    class_validator_1.IsBoolean(),
    __metadata("design:type", Boolean)
], CreateMenuReq.prototype, "isMenu", void 0);
exports.CreateMenuReq = CreateMenuReq;
class EditMenuReq {
}
__decorate([
    class_validator_1.IsString(),
github notadd / next / packages / common / entities / log.entity.js View on Github external
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const typeorm_1 = require("typeorm");
const class_validator_1 = require("class-validator");
let Log = class Log {
};
__decorate([
    typeorm_1.PrimaryGeneratedColumn(),
    __metadata("design:type", Number)
], Log.prototype, "id", void 0);
__decorate([
    typeorm_1.Column(),
    class_validator_1.IsString(),
    __metadata("design:type", String)
], Log.prototype, "content", void 0);
__decorate([
    typeorm_1.CreateDateColumn(),
    __metadata("design:type", String)
], Log.prototype, "createdAt", void 0);
__decorate([
    typeorm_1.UpdateDateColumn(),
    __metadata("design:type", String)
], Log.prototype, "updatedAt", void 0);
Log = __decorate([
    typeorm_1.Entity('logs')
], Log);
exports.Log = Log;
github notadd / next / packages / common / entities / setting.entity.js View on Github external
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const typeorm_1 = require("typeorm");
const class_validator_1 = require("class-validator");
let Setting = class Setting {
};
__decorate([
    typeorm_1.PrimaryColumn(),
    class_validator_1.IsString(),
    __metadata("design:type", String)
], Setting.prototype, "key", void 0);
__decorate([
    typeorm_1.Column(),
    class_validator_1.IsString(),
    __metadata("design:type", String)
], Setting.prototype, "value", void 0);
__decorate([
    typeorm_1.CreateDateColumn(),
    __metadata("design:type", String)
], Setting.prototype, "createdAt", void 0);
__decorate([
    typeorm_1.UpdateDateColumn(),
    __metadata("design:type", String)
], Setting.prototype, "updatedAt", void 0);
Setting = __decorate([
github nestjsx / crud / dist / dto / filter-param.dto.js View on Github external
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const class_validator_1 = require("class-validator");
const operators_list_1 = require("../operators.list");
class FilterParamDto {
}
__decorate([
    class_validator_1.IsNotEmpty(),
    class_validator_1.IsString(),
    __metadata("design:type", String)
], FilterParamDto.prototype, "field", void 0);
__decorate([
    class_validator_1.IsNotEmpty(),
    class_validator_1.IsIn(operators_list_1.COMPARISON_OPERATORS),
    __metadata("design:type", String)
], FilterParamDto.prototype, "operator", void 0);
__decorate([
    class_validator_1.IsOptional(),
    __metadata("design:type", Object)
], FilterParamDto.prototype, "value", void 0);
exports.FilterParamDto = FilterParamDto;
//# sourceMappingURL=filter-param.dto.js.map
github joe307bad / points / Shared.Points / dist / achievement.dto.js View on Github external
const class_validator_1 = require("class-validator");
const base_dto_1 = require("./base.dto");
class AchievementDto extends base_dto_1.BaseDto {
    constructor() {
        super(...arguments);
        this.id = '';
        this.achievementId = '';
        this.name = '';
        this.description = '';
        this.points = 0;
        this.category = '';
        this.photo = '';
    }
}
__decorate([
    class_validator_1.IsString(),
    class_validator_1.IsNotEmpty(),
    class_validator_1.MaxLength(200, { message: '200 character max' })
], AchievementDto.prototype, "name", void 0);
__decorate([
    class_validator_1.IsString(),
    class_validator_1.IsNotEmpty(),
    class_validator_1.MaxLength(200, { message: '200 character max' })
], AchievementDto.prototype, "description", void 0);
__decorate([
    class_validator_1.IsInt(),
    class_validator_1.IsNotEmpty()
], AchievementDto.prototype, "points", void 0);
exports.AchievementDto = AchievementDto;