Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { PrimaryGeneratedColumn, Column, Entity, OneToOne, OneToMany, ManyToOne, ManyToMany, JoinColumn, JoinTable } from "typeorm";
import {Post} from "./Post";
@Entity("PostAuthor")
export class PostAuthor {
@PrimaryGeneratedColumn()
id: number;
@Column()
name: string;
@ManyToMany(type => Post, post => post.postAuthors)
posts: Post[];
}
import {
Entity,
Column,
PrimaryColumn,
ManyToOne,
CreateDateColumn,
UpdateDateColumn,
OneToMany,
} from 'typeorm';
import Session from './Session';
import User from './User';
import Vote from './Vote';
@Entity({ name: 'posts' })
export default class Post {
@PrimaryColumn({ primary: true, generated: false, unique: true })
public id: string;
@ManyToOne(() => Session, { nullable: false })
public session: Session;
@Column({ default: 0 })
public column: number;
@Column()
public content: string;
@Column({ nullable: true, type: 'character varying' })
public action: null | string;
@ManyToOne(() => User, { eager: true, cascade: true, nullable: false })
public user: User;
@OneToMany(
() => Vote,
vote => vote.post,
coinbase: Buffer
root: Buffer
txHash: Buffer
receiptHash: Buffer
bloom: Buffer
difficulty: BigNumber
number: BigNumber
gasLimit: BigNumber
gasUsed: BigNumber
time: BigNumber
extra: Buffer
mixDigest: Buffer
nonce: Buffer
}
@Entity({ name: 'ethereum_head' })
export class Head {
public static build({
blockHash,
parentHash,
uncleHash,
coinbase,
root,
txHash,
receiptHash,
bloom,
difficulty,
number,
gasLimit,
gasUsed,
time,
extra,
import { ConfigArg } from '../../../../shared/generated-types';
import { DeepPartial } from '../../../../shared/shared-types';
import { UserInputError } from '../../common/error/errors';
import { getConfig } from '../../config/config-helpers';
import { VendureEntity } from '../base/base.entity';
import { Order } from '../order/order.entity';
import { Payment, PaymentMetadata } from '../payment/payment.entity';
/**
* @description
* A PaymentMethod is created automatically according to the configured {@link PaymentMethodHandler}s defined
* in the {@link PaymentOptions} config.
*
* @docsCategory entities
*/
@Entity()
export class PaymentMethod extends VendureEntity {
constructor(input?: DeepPartial) {
super(input);
}
@Column() code: string;
@Column() enabled: boolean;
@Column('simple-json') configArgs: ConfigArg[];
async createPayment(order: Order, metadata: PaymentMetadata) {
const handler = getConfig().paymentOptions.paymentMethodHandlers.find(h => h.code === this.code);
if (!handler) {
throw new UserInputError(`error.no-payment-handler-with-code`, { code: this.code });
}
import { DeepPartial } from '@vendure/common/lib/shared-types';
import { Column, Entity, JoinColumn, OneToMany, OneToOne } from 'typeorm';
import { Address } from '../address/address.entity';
import { VendureEntity } from '../base/base.entity';
import { CustomCustomerFields } from '../custom-entity-fields';
import { User } from '../user/user.entity';
/**
* @description
* An Asset represents a file such as an image which can be associated with certain other entities
* such as Products.
*
* @docsCategory entities
*/
@Entity()
export class Asset extends VendureEntity {
constructor(input?: DeepPartial) {
super(input);
}
@Column() name: string;
@Column('varchar') type: AssetType;
@Column() mimeType: string;
@Column({ default: 0 }) width: number;
@Column({ default: 0 }) height: number;
@Column() fileSize: number;
import { Entity, ObjectIdColumn, Column } from 'typeorm'
import * as uuid from 'uuid'
import { Expose, plainToClass } from 'class-transformer'
enum Type {
VERIFY_EMAIL,
FORGOT_PASSWORD,
}
@Entity({
name: 'emails',
orderBy: {
createdAt: 'ASC',
},
})
export class Email {
@Expose()
@ObjectIdColumn()
_id: string
@Expose()
@Column()
userId: string
@Expose()
@Column()
import { Entity, Column } from 'typeorm';
import { BaseEntity } from '../../../shared/model/entities/base-entity.entity';
import { ApiModelPropertyOptional } from '@nestjs/swagger';
import { CrudValidationGroups } from '@nestjsx/crud';
import { IsDefined, IsOptional, MaxLength, IsEmail } from 'class-validator';
@Entity()
export class Employee extends BaseEntity {
@ApiModelPropertyOptional()
@IsDefined({ groups: [CrudValidationGroups.CREATE] })
@IsOptional({ groups: [CrudValidationGroups.UPDATE] })
@MaxLength(255)
@Column('varchar', { length: 255, nullable: true })
name?: string;
@ApiModelPropertyOptional()
@IsDefined({ groups: [CrudValidationGroups.CREATE] })
@IsOptional({ groups: [CrudValidationGroups.UPDATE] })
@MaxLength(255)
@Column('varchar', { length: 255, nullable: true })
surname?: string;
@ApiModelPropertyOptional()