UNPKG

@authup/server-api

Version:

This is a standalone application.

148 lines 5.82 kB
"use strict"; /* * Copyright (c) 2021-2021. * Author Peter Placzek (tada5hi) * For the full copyright and license information, * view the LICENSE file that was distributed with this source code. */ 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.UserEntity = void 0; const typeorm_1 = require("typeorm"); const realm_1 = require("../realm"); let UserEntity = class UserEntity { // ------------------------------------------------------------------ setDisplayName() { if (typeof this.display_name !== 'string' || this.display_name.length === 0) { this.display_name = this.name; } } }; exports.UserEntity = UserEntity; __decorate([ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'), __metadata("design:type", String) ], UserEntity.prototype, "id", void 0); __decorate([ (0, typeorm_1.Index)(), (0, typeorm_1.Column)({ type: 'varchar', length: 128 }), __metadata("design:type", String) ], UserEntity.prototype, "name", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'boolean', default: true }), __metadata("design:type", Boolean) ], UserEntity.prototype, "name_locked", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 128, nullable: true }), __metadata("design:type", String) ], UserEntity.prototype, "first_name", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 128, nullable: true }), __metadata("design:type", String) ], UserEntity.prototype, "last_name", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 128 }), __metadata("design:type", String) ], UserEntity.prototype, "display_name", void 0); __decorate([ (0, typeorm_1.Index)(), (0, typeorm_1.Column)({ type: 'varchar', length: 256, default: null, nullable: true, select: false, }), __metadata("design:type", String) ], UserEntity.prototype, "email", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 512, default: null, nullable: true, select: false, }), __metadata("design:type", String) ], UserEntity.prototype, "password", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }), __metadata("design:type", String) ], UserEntity.prototype, "avatar", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }), __metadata("design:type", String) ], UserEntity.prototype, "cover", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 256, nullable: true, default: null, select: false, }), __metadata("design:type", String) ], UserEntity.prototype, "reset_hash", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 28, nullable: true, default: null, select: false, }), __metadata("design:type", String) ], UserEntity.prototype, "reset_at", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 28, nullable: true, default: null, select: false, }), __metadata("design:type", String) ], UserEntity.prototype, "reset_expires", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 256, nullable: true, default: null, }), __metadata("design:type", String) ], UserEntity.prototype, "status", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 256, nullable: true, default: null, }), __metadata("design:type", String) ], UserEntity.prototype, "status_message", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'boolean', default: true, }), __metadata("design:type", Boolean) ], UserEntity.prototype, "active", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 256, nullable: true, default: null, select: false, }), __metadata("design:type", String) ], UserEntity.prototype, "activate_hash", void 0); __decorate([ (0, typeorm_1.CreateDateColumn)(), __metadata("design:type", Date) ], UserEntity.prototype, "created_at", void 0); __decorate([ (0, typeorm_1.UpdateDateColumn)(), __metadata("design:type", Date) ], UserEntity.prototype, "updated_at", void 0); __decorate([ (0, typeorm_1.Index)(), (0, typeorm_1.Column)(), __metadata("design:type", Object) ], UserEntity.prototype, "realm_id", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => realm_1.RealmEntity, { onDelete: 'CASCADE' }), (0, typeorm_1.JoinColumn)({ name: 'realm_id' }), __metadata("design:type", Object) ], UserEntity.prototype, "realm", void 0); __decorate([ (0, typeorm_1.BeforeInsert)(), (0, typeorm_1.BeforeUpdate)(), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], UserEntity.prototype, "setDisplayName", null); exports.UserEntity = UserEntity = __decorate([ (0, typeorm_1.Entity)({ name: 'auth_users' }), (0, typeorm_1.Unique)(['name', 'realm_id']) ], UserEntity); //# sourceMappingURL=entity.js.map