Exemplo n.º 1
0
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 });
require("reflect-metadata");
const typeorm_1 = require("typeorm");
const typeorm_2 = require("typeorm");
let Photo = class Photo {
};
__decorate([
    typeorm_2.PrimaryGeneratedColumn(),
    __metadata("design:type", Number)
], Photo.prototype, "id", void 0);
__decorate([
    typeorm_2.Column({
        length: 500
    }),
    __metadata("design:type", String)
], Photo.prototype, "name", void 0);
__decorate([
    typeorm_2.Column("text"),
    __metadata("design:type", String)
], Photo.prototype, "description", void 0);
__decorate([
    typeorm_2.Column(),
    __metadata("design:type", String)
], Photo.prototype, "fileName", void 0);
__decorate([
    typeorm_2.Column("int"),
    __metadata("design:type", Number)
], Photo.prototype, "views", void 0);
Exemplo n.º 2
0
Arquivo: User.js Projeto: Porayj/test
    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");
let User = class User {
};
__decorate([
    typeorm_1.PrimaryGeneratedColumn(),
    __metadata("design:type", Number)
], User.prototype, "id", void 0);
__decorate([
    typeorm_1.Column(),
    __metadata("design:type", String)
], User.prototype, "firstName", void 0);
__decorate([
    typeorm_1.Column(),
    __metadata("design:type", String)
], User.prototype, "lastName", void 0);
__decorate([
    typeorm_1.Column(),
    __metadata("design:type", Number)
], User.prototype, "age", void 0);
User = __decorate([
    typeorm_1.Entity()
], User);
exports.User = User;
    primerConsole() {
        console.log(`Esta es el primer console`);
    }
    segundoConsole() {
        console.log(`El titulo es ${this.titulo}`);
    }
};
__decorate([
    typeorm_1.PrimaryGeneratedColumn(),
    __metadata("design:type", Number)
], NoticiaEntity.prototype, "id", void 0);
__decorate([
    typeorm_1.Index(),
    typeorm_1.Column({
        name: 'titulo_noticia',
        type: 'varchar',
        length: 50
    }),
    __metadata("design:type", String)
], NoticiaEntity.prototype, "titulo", void 0);
__decorate([
    typeorm_1.Column({
        name: 'descripcion_noticia',
        type: 'text',
        nullable: true
    }),
    __metadata("design:type", String)
], NoticiaEntity.prototype, "descripcion", void 0);
__decorate([
    typeorm_1.OneToMany(type => pagina_entity_1.PaginaEntity, pagina => pagina.noticias),
    __metadata("design:type", Array)
Exemplo n.º 4
0
Arquivo: app.js Projeto: Porayj/test
const express = require("express");
const cors = require("cors"); //New line
const bodyParser = require("body-parser");
require("reflect-metadata");
const typeorm_1 = require("typeorm");
const app = express();
app.use(cors());
app.use(bodyParser.urlencoded({ extended: false }));
let goodDB = class goodDB {
};
__decorate([
    typeorm_1.PrimaryGeneratedColumn(),
    __metadata("design:type", Number)
], goodDB.prototype, "id", void 0);
__decorate([
    typeorm_1.Column(),
    __metadata("design:type", String)
], goodDB.prototype, "name", void 0);
__decorate([
    typeorm_1.Column('float'),
    __metadata("design:type", Number)
], goodDB.prototype, "price", void 0);
__decorate([
    typeorm_1.Column(''),
    __metadata("design:type", String)
], goodDB.prototype, "manufacturer", void 0);
goodDB = __decorate([
    typeorm_1.Entity()
], goodDB);
exports.goodDB = goodDB;
;