Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
get webLink() {
return `https://www.instagram.com/p/${this.code}/`;
}
// Backward compatibility
@Expose()
get account() {
return this.user;
}
@Expose()
get takenAt() {
return this.taken_at * 1000;
}
@Expose()
get images() {
return this.image_versions2;
}
@Expose()
get videos() {
return this.video_versions;
}
}
@OneToMany((type) => User, (user) => user.role)
users: User[];
static readonly sheetsMap: object = {
角色: {
map: 'roles',
handleType: ExcelHandleType.ARRAY,
cellsMap: { ID: 'id', 名称: 'name', 标识: 'token', 描述: 'desc', 排序: 'sort' }
}
};
static create(target: Object) {
return plainToClass(Role, target);
}
@Expose()
get isSuperAdmin(): boolean {
return this.token === 'superAdmin';
}
}
@TreeParent() parent: Authority;
@ManyToMany((type) => Role, (role) => role.authorities)
roles: Role[];
@Expose()
get label(): string {
return this.name;
}
@Expose()
get title(): string {
return this.name;
}
@Expose()
get key(): string {
return this.id;
}
@Expose()
get value(): string {
return this.id;
}
static readonly sheetsMap: object = {
权限: {
map: 'authorities',
handleType: ExcelHandleType.ARRAY,
cellsMap: {
ID: 'id',
名称: 'name',
@Expose()
get label(): string {
return this.name;
}
@Expose()
get title(): string {
return this.name;
}
@Expose()
get key(): string {
return this.id;
}
@Expose()
get value(): string {
return this.id;
}
static readonly sheetsMap: object = {
权限: {
map: 'authorities',
handleType: ExcelHandleType.ARRAY,
cellsMap: {
ID: 'id',
名称: 'name',
标识: 'token',
描述: 'desc',
排序: 'sort',
PID: 'parent'
}
@TreeChildren() children: Category[];
@TreeParent() parent: Category;
@Expose()
get title(): string {
return this.name;
}
@Expose()
get key(): string {
return this.id;
}
@Expose()
get value(): string {
return this.id;
}
static readonly sheetsMap: object = {
分类: {
map: 'categorys',
handleType: ExcelHandleType.ARRAY,
cellsMap: { ID: 'id', 名称: 'name', 排序: 'sort', PID: 'parent' }
}
};
static create(target: object) {
return plainToClass(Category, target);
}
}
@Column({ type: 'simple-json', default: {}, comment: '扩展信息' })
ex_info: any;
@TreeChildren() children: Authority[];
@TreeParent() parent: Authority;
@ManyToMany((type) => Role, (role) => role.authorities)
roles: Role[];
@Expose()
get label(): string {
return this.name;
}
@Expose()
get title(): string {
return this.name;
}
@Expose()
get key(): string {
return this.id;
}
@Expose()
get value(): string {
return this.id;
}
static readonly sheetsMap: object = {
权限: {
@Column({ type: 'simple-json', default: {}, comment: '扩展信息' })
ex_info: any;
static readonly sheetsMap: object = {
轮播: {
map: 'carousels',
handleType: ExcelHandleType.ARRAY,
cellsMap: { 标识: 'token' }
}
};
static create(target: object): Carousel | Carousel[] {
return plainToClass(Carousel, target);
}
@Expose()
get carousels() {
return !this.ex_info.carousels
? []
: this.ex_info.carousels.map((item) => {
const newItem = { ...item };
newItem.image = Base.getFullPath(item.image);
return newItem;
});
}
}
@OneToMany((type) => Flow, (flow) => flow.executor)
executeFlows: Flow[];
@OneToMany((type) => Detail, (detail) => detail.user)
details: Detail[];
static create(target: Object) {
return plainToClass(User, target);
}
@Expose()
get avatarPath(): string {
return Base.getFullPath(this.avatar);
}
@Expose()
get isSuperAdmin(): boolean {
return !!this.role && this.role.token === 'superAdmin';
}
@Expose()
get isVolunteer(): boolean {
return !!this.role && this.role.token === 'volunteer';
}
@BeforeInsert()
async beforeInsert() {
const salt = await bcrypt.genSalt(10);
this.password = await bcrypt.hash(this.password || '12345678', salt);
}
@BeforeUpdate()
@Expose()
get account() {
return this.user;
}
@Expose()
get takenAt() {
return this.taken_at * 1000;
}
@Expose()
get images() {
return this.image_versions2;
}
@Expose()
get videos() {
return this.video_versions;
}
}
}
}
}
}
};
static create(target: object): Content | Content[] {
return plainToClass(Content, target);
}
@Expose()
get thumbnailPath(): string {
return Base.getFullPath(this.thumbnail);
}
@Expose()
get videoPath(): string {
return Base.getFullPath(this.video);
}
@BeforeInsert()
async beforeInsert() {
if (!this.publish_at) {
this.publish_at = moment().format('YYYY-MM-DD HH:mm:ss');
}
const text = extractionTextInHtml(this.text);
this.summary = textInterception(text, 120);
}
@BeforeUpdate()
async beforeUpdate() {
const text = extractionTextInHtml(this.text);