Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Entity, BaseEntity, PrimaryGeneratedColumn, Column, PrimaryColumn, OneToOne, JoinColumn } from "typeorm"
import { User } from "./User"
import * as uuid from 'uuid'
@Entity()
class AuthToken extends BaseEntity {
@PrimaryColumn("uuid")
token: string
@Column({ default: () => "(CURRENT_TIMESTAMP + interval '3' day)" })
expiry: Date
@PrimaryColumn("uuid")
refreshToken: string
@Column({ default: () => "(CURRENT_TIMESTAMP + interval '30' day)" })
refreshExpiry: Date
@OneToOne(type => User, { nullable: false })
@JoinColumn()
user: User
public constructor() {
import { Entity, PrimaryColumn } from 'typeorm';
@Entity()
export class Hashtag {
@PrimaryColumn('text')
name: string;
constructor(name: string) {
this.name = name;
}
}
import { idType } from '../../config/config-helpers';
@Entity()
export class SearchIndexItem {
constructor(input?: Partial) {
if (input) {
for (const [key, value] of Object.entries(input)) {
this[key] = value;
}
}
}
@PrimaryColumn({ type: idType() })
productVariantId: ID;
@PrimaryColumn('varchar')
languageCode: LanguageCode;
@Column({ type: idType() })
productId: ID;
@Index({ fulltext: true })
@Column()
productName: string;
@Index({ fulltext: true })
@Column()
productVariantName: string;
@Index({ fulltext: true })
@Column('text')
description: string;
export function PrimaryIdColumn(options?: ColumnOptions) {
let op: ColumnOptions = { type: "varchar", length: 36 };
Object.assign(op, options || {});
return PrimaryColumn(op);
}
PrimaryColumn,
OneToMany,
OneToOne,
BeforeInsert,
BeforeUpdate,
UpdateDateColumn,
CreateDateColumn,
} from 'typeorm';
import {DbNote} from './dbnote.entity';
import {DbFileTreeNode} from './filenode.entity';
import {INote, IFilePathItem, INotebook} from 'shared';
import {dbConf} from '../config/db-conf';
@Entity({name: 'notebooks'})
export class DbNotebook implements INotebook {
@PrimaryColumn(dbConf.idColumn)
id!: string;
@Column(dbConf.shortTextField)
name!: string;
@Column(dbConf.shortTextField)
owner!: string;
@UpdateDateColumn(dbConf.dateUpdated)
dateUpdated!: number;
@CreateDateColumn(dbConf.dateCreated)
dateCreated!: number;
@Column({...dbConf.json, name: 'json_content'})
jsonContent: any = {};
import { EntityId } from '../../entity/entity-id.decorator';
@Entity()
export class SearchIndexItem {
constructor(input?: Partial) {
if (input) {
for (const [key, value] of Object.entries(input)) {
(this as any)[key] = value;
}
}
}
@EntityId({ primary: true })
productVariantId: ID;
@PrimaryColumn('varchar')
languageCode: LanguageCode;
@EntityId()
productId: ID;
@Column()
enabled: boolean;
@Index({ fulltext: true })
@Column()
productName: string;
@Index({ fulltext: true })
@Column()
productVariantName: string;
JoinColumn,
ManyToOne,
PrimaryColumn,
UpdateDateColumn,
} from "typeorm";
import { Comment } from "./Comment";
import { User } from "./User";
@Entity()
@ObjectType()
export class CommentMentionNotification {
@Field(() => Comment)
@ManyToOne(() => Comment, { onDelete: "CASCADE" })
comment: Promise;
@Field()
@PrimaryColumn("uuid")
commentId: string;
@ManyToOne(() => User, { onDelete: "CASCADE" })
@JoinColumn({ name: "userMentionedId" })
userMentioned: Promise;
@Field()
@Column("uuid")
userMentionedId: string;
@Field()
@Column()
read: boolean;
@Field()
@CreateDateColumn({ type: "timestamp with time zone" })
createdAt: Date;
],
mutations: [
getCreateQuery,
getDeleteQuery,
getUpdateQuery
]
})
@Entity()
export class AppUser {
@ColumnApi({
apiName: 'id',
apiType: 'Int',
apiDescription: 'unique identifier'
})
@PrimaryColumn('int', { generated: true })
id: number;
@ColumnApi({
apiName: 'firstName',
apiType: 'String',
apiDescription: 'the first name',
updatable: true,
requiredForCreate: true
})
@Column('string', { nullable: true })
firstName: string;
@ColumnApi({
apiName: 'lastName',
apiType: 'String',
apiDescription: 'the last name',
import {
Column,
Entity,
PrimaryColumn,
UpdateDateColumn,
} from 'typeorm';
import { IGetCorporation } from '@new-eden-social/esi';
import { ICorporationIcon } from './corporation.interface';
@Entity()
export class Corporation {
@PrimaryColumn('int')
id: number;
@Column({ unique: true })
handle: string;
@Column()
name: string;
@Column()
ticker: string;
@Column('text')
description: string;
@Column()
ceoId?: number;