express-typeorm-rest-boilerplate
Version:
Boilerplate code to get started with building RESTful API Services
76 lines • 2.97 kB
JavaScript
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 });
exports.JobApplication = void 0;
const typeorm_1 = require("typeorm");
const class_validator_1 = require("class-validator");
let JobApplication = class JobApplication {
constructor(data) {
this.createdAt = new Date().toISOString();
if (data) {
this.role = data.role;
this.description = data.description;
this.company = data.company;
this.user = data.user;
this.status = data.status;
this.appliedDate = data.appliedDate;
this.updatedAt = new Date().toISOString();
}
}
};
__decorate([
typeorm_1.ObjectIdColumn(),
__metadata("design:type", typeorm_1.ObjectID)
], JobApplication.prototype, "id", void 0);
__decorate([
typeorm_1.Column(),
class_validator_1.IsString(),
__metadata("design:type", String)
], JobApplication.prototype, "role", void 0);
__decorate([
typeorm_1.Column(),
class_validator_1.IsString(),
__metadata("design:type", String)
], JobApplication.prototype, "description", void 0);
__decorate([
typeorm_1.Column(),
class_validator_1.IsNotEmpty(),
__metadata("design:type", Object)
], JobApplication.prototype, "company", void 0);
__decorate([
typeorm_1.Column(),
class_validator_1.IsNotEmpty(),
__metadata("design:type", Object)
], JobApplication.prototype, "user", void 0);
__decorate([
typeorm_1.Column(),
class_validator_1.IsString(),
__metadata("design:type", String)
], JobApplication.prototype, "status", void 0);
__decorate([
typeorm_1.Column(),
class_validator_1.IsString(),
__metadata("design:type", String)
], JobApplication.prototype, "appliedDate", void 0);
__decorate([
typeorm_1.Column(),
__metadata("design:type", String)
], JobApplication.prototype, "createdAt", void 0);
__decorate([
typeorm_1.Column(),
__metadata("design:type", String)
], JobApplication.prototype, "updatedAt", void 0);
JobApplication = __decorate([
typeorm_1.Entity(),
__metadata("design:paramtypes", [JobApplication])
], JobApplication);
exports.JobApplication = JobApplication;
//# sourceMappingURL=JobApplication.js.map
;