---
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
|
||||
import { User } from './User'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class CV extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number
|
||||
|
||||
@Field()
|
||||
@Column()
|
||||
filename?: string
|
||||
|
||||
@Field()
|
||||
@Column()
|
||||
key?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
url?: string
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
@Column({ nullable: true })
|
||||
userId?: number
|
||||
|
||||
@Field(() => User, { nullable: true })
|
||||
@ManyToOne(() => User, user => user.cvs, { onDelete: 'CASCADE' })
|
||||
user?: User
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Column, CreateDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
|
||||
import { CommentVote, Post, User, Page } from '@entities'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class Comment extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
@CreateDateColumn()
|
||||
createdAt?: Date
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updatedAt?: Date
|
||||
|
||||
@Field()
|
||||
@Column()
|
||||
text!: string
|
||||
|
||||
@Field(() => String)
|
||||
@Column({ default: 'user' })
|
||||
creatorType?: 'page' | 'user'
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
@Column({ nullable: true })
|
||||
creatorId?: number
|
||||
|
||||
@Field(() => User, { nullable: true })
|
||||
@ManyToOne(() => User, user => user.comments, { onDelete: 'CASCADE' })
|
||||
creator?: User
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
@Column({ nullable: true })
|
||||
pageCreatorId?: number
|
||||
|
||||
@Field(() => Page, { nullable: true })
|
||||
@ManyToOne(() => Page, page => page.posts, { onDelete: 'CASCADE' })
|
||||
pageCreator?: Page
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
@Column({ nullable: false })
|
||||
postId?: number
|
||||
|
||||
@ManyToOne(() => Post, post => post.comments, { onDelete: 'CASCADE' })
|
||||
post?: Post
|
||||
|
||||
@OneToMany(() => CommentVote, commentVote => commentVote.comment)
|
||||
votes?: CommentVote[]
|
||||
|
||||
@Field(() => Int)
|
||||
@Column({ type: 'int', default: 0 })
|
||||
points!: number
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
voteStatus?: number
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { Comment, User } from '@entities'
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Column, Entity, ManyToOne, PrimaryColumn } from 'typeorm'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class CommentVote extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@Column({ type: 'int' })
|
||||
value!: number
|
||||
|
||||
@Field(() => Int)
|
||||
@PrimaryColumn()
|
||||
userId!: number
|
||||
|
||||
@Field(() => User)
|
||||
@ManyToOne(() => User, user => user.commentVotes, { onDelete: 'CASCADE' })
|
||||
user?: User
|
||||
|
||||
@Field(() => Int)
|
||||
@PrimaryColumn()
|
||||
commentId!: number
|
||||
|
||||
@Field(() => Comment)
|
||||
@ManyToOne(() => Comment, comment => comment.votes, { onDelete: 'CASCADE' })
|
||||
comment?: Comment
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class Conversation extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number
|
||||
|
||||
@Field(() => [Int])
|
||||
@Column('int', { array: true })
|
||||
participants: number[]
|
||||
|
||||
@Field()
|
||||
@Column()
|
||||
firestoreCollectionId: string
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
|
||||
import { User } from './User'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class EducationItem extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number
|
||||
|
||||
@Field()
|
||||
@Column()
|
||||
school?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
status?: string
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
@Column({ nullable: true, type: 'timestamptz' })
|
||||
startDate?: Date
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
@Column({ nullable: true, type: 'timestamptz' })
|
||||
endDate?: Date
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
@Column({ nullable: true })
|
||||
userId?: number
|
||||
|
||||
@Field(() => User, { nullable: true })
|
||||
@ManyToOne(() => User, user => user.educationItems, { onDelete: 'CASCADE' })
|
||||
user?: User
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
photo?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
photoUrl?: string
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
|
||||
import { User } from './User'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class Experience extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number
|
||||
|
||||
@Field()
|
||||
@Column()
|
||||
title?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
workplace?: string
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
@Column({ nullable: true, type: 'timestamptz' })
|
||||
startDate?: Date
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
@Column({ nullable: true, type: 'timestamptz' })
|
||||
endDate?: Date
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
@Column({ nullable: true })
|
||||
userId?: number
|
||||
|
||||
@Field(() => User, { nullable: true })
|
||||
@ManyToOne(() => User, user => user.experiences, { onDelete: 'CASCADE' })
|
||||
user?: User
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
photo?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
photoUrl?: string
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
import { OfferApplication, Page, Space, User } from '@entities'
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Column, CreateDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class Offer extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number
|
||||
|
||||
@Field(() => String)
|
||||
@CreateDateColumn()
|
||||
createdAt?: Date
|
||||
|
||||
@Field(() => String)
|
||||
@UpdateDateColumn()
|
||||
updatedAt?: Date
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
@Column({ default: 'user' })
|
||||
creatorType?: 'page' | 'user'
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
@Column({ nullable: true })
|
||||
creatorId!: number
|
||||
|
||||
@Field(() => User, { nullable: true })
|
||||
@ManyToOne(() => User, user => user.offers, { onDelete: 'CASCADE' })
|
||||
creator?: User
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
@Column({ nullable: true })
|
||||
pageCreatorId?: number
|
||||
|
||||
@Field(() => Page, { nullable: true })
|
||||
@ManyToOne(() => Page, page => page.offers, { onDelete: 'CASCADE' })
|
||||
pageCreator?: Page
|
||||
|
||||
@Field(() => Int)
|
||||
@Column()
|
||||
spaceId!: number
|
||||
|
||||
@Field(() => Space, { nullable: true })
|
||||
@ManyToOne(() => Space, space => space.posts, { onDelete: 'CASCADE' })
|
||||
space?: Space
|
||||
|
||||
@Field()
|
||||
@Column()
|
||||
title: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
workplace?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
address?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: false, default: false })
|
||||
recruiting?: boolean
|
||||
|
||||
@Field(() => [OfferApplication], { nullable: true })
|
||||
@OneToMany(() => OfferApplication, offerApplication => offerApplication.offer)
|
||||
applications: OfferApplication[]
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
employmentType?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
salaryRange?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
department?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
requirements?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
benefits?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
description?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
photo?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
photoUrl?: string
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
applicationsNo?: number
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
applicationStatus?: 'applied' | 'accepted' | 'rejected'
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Column, Entity, ManyToOne, PrimaryColumn, PrimaryGeneratedColumn } from 'typeorm'
|
||||
import { User, Offer } from '@entities'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class OfferApplication extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number
|
||||
|
||||
@Field(() => Int)
|
||||
@Column()
|
||||
userId!: number
|
||||
|
||||
@Field(() => User)
|
||||
@ManyToOne(() => User, user => user.applications, { onDelete: 'CASCADE', cascade: true })
|
||||
user?: User
|
||||
|
||||
@Field(() => Int)
|
||||
@Column()
|
||||
offerId!: number
|
||||
|
||||
@Field(() => Offer)
|
||||
@ManyToOne(() => Offer, offer => offer.applications, { onDelete: 'CASCADE', cascade: true })
|
||||
offer?: Offer
|
||||
|
||||
@Field()
|
||||
@Column({ default: 'applied' })
|
||||
status!: 'applied' | 'accepted' | 'rejected'
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import { Comment, Offer, Post, User, PageFollow } from '@entities'
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Column, CreateDateColumn, Entity, JoinTable, ManyToMany, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class Page extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
@CreateDateColumn()
|
||||
createdAt?: Date
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updatedAt?: Date
|
||||
|
||||
@Field(() => [User], { nullable: true })
|
||||
@ManyToMany(() => User, { cascade: true })
|
||||
@JoinTable()
|
||||
owners?: User[]
|
||||
|
||||
@Field(() => Boolean, { nullable: true })
|
||||
ownerStatus?: boolean
|
||||
|
||||
@OneToMany(() => PageFollow, pageFollow => pageFollow.page)
|
||||
pageFollows?: PageFollow[]
|
||||
|
||||
@Field(() => Boolean, { nullable: true })
|
||||
followStatus?: boolean
|
||||
|
||||
@Field(() => Int)
|
||||
followerNumber?: number
|
||||
|
||||
@Field()
|
||||
@Column({ unique: true, nullable: false })
|
||||
pageName?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ unique: true, nullable: true })
|
||||
email?: string
|
||||
|
||||
@OneToMany(() => Post, post => post.pageCreator)
|
||||
posts?: Post[]
|
||||
|
||||
@OneToMany(() => Offer, offer => offer.pageCreator)
|
||||
offers?: Offer[]
|
||||
|
||||
@Field(() => [Comment], { nullable: true })
|
||||
@OneToMany(() => Comment, comment => comment.creator)
|
||||
comments?: Comment[]
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
avatar?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
avatarUrl?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
coverPhoto?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
coverPhotoUrl?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
fullPageName?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
headline?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
address?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
about?: string
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Entity, ManyToOne, PrimaryColumn } from 'typeorm'
|
||||
import { Page } from './Page'
|
||||
import { User } from './User'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class PageFollow extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryColumn()
|
||||
userId!: number
|
||||
|
||||
@Field(() => User)
|
||||
@ManyToOne(() => User, user => user.pageFollows, { onDelete: 'CASCADE' })
|
||||
user?: User
|
||||
|
||||
@Field(() => Int)
|
||||
@PrimaryColumn()
|
||||
pageId!: number
|
||||
|
||||
@Field(() => Page)
|
||||
@ManyToOne(() => Page, page => page.pageFollows, { onDelete: 'CASCADE' })
|
||||
page?: Page
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Column, CreateDateColumn, Entity, JoinTable, ManyToMany, ManyToOne, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
|
||||
import { Vote, User, Space, Comment, Tag, Page } from '@entities'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class Post extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number
|
||||
|
||||
@Field(() => String)
|
||||
@CreateDateColumn()
|
||||
createdAt?: Date
|
||||
|
||||
@Field(() => String)
|
||||
@UpdateDateColumn()
|
||||
updatedAt?: Date
|
||||
|
||||
@Field()
|
||||
@Column()
|
||||
title!: string
|
||||
|
||||
@Field()
|
||||
@Column()
|
||||
text!: string
|
||||
|
||||
@Field(() => String)
|
||||
@Column({ default: 'user' })
|
||||
creatorType?: 'page' | 'user'
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
@Column({ nullable: true })
|
||||
creatorId?: number
|
||||
|
||||
@Field(() => User, { nullable: true })
|
||||
@ManyToOne(() => User, user => user.posts, { onDelete: 'CASCADE' })
|
||||
creator?: User
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
@Column({ nullable: true })
|
||||
pageCreatorId?: number
|
||||
|
||||
@Field(() => Page, { nullable: true })
|
||||
@ManyToOne(() => Page, page => page.posts, { onDelete: 'CASCADE' })
|
||||
pageCreator?: Page
|
||||
|
||||
@OneToMany(() => Vote, vote => vote.post)
|
||||
votes?: Vote[]
|
||||
|
||||
@Field(() => Int)
|
||||
@Column({ type: 'int', default: 0 })
|
||||
points!: number
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
voteStatus?: number
|
||||
|
||||
@Field(() => Int)
|
||||
@Column()
|
||||
spaceId!: number
|
||||
|
||||
@Field(() => Space)
|
||||
@ManyToOne(() => Space, space => space.posts, { onDelete: 'CASCADE' })
|
||||
space!: Space
|
||||
|
||||
@OneToMany(() => Comment, comment => comment.post)
|
||||
comments?: Comment[]
|
||||
|
||||
@Field(() => [Tag], { nullable: true })
|
||||
@ManyToMany(() => Tag, { cascade: true })
|
||||
@JoinTable() // Put @JoinTable() on owner side of a MTM relationship
|
||||
tags: Tag[]
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
|
||||
import { User } from './User'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class Qualification extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number
|
||||
|
||||
@Field()
|
||||
@Column()
|
||||
name!: string
|
||||
|
||||
@Field()
|
||||
@Column()
|
||||
issuingOrganisation!: string
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
@Column({ nullable: true, type: 'timestamptz' })
|
||||
issuanceDate?: Date
|
||||
|
||||
@Field()
|
||||
@Column()
|
||||
expire!: boolean
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
@Column({ nullable: true, type: 'timestamptz' })
|
||||
expirationDate?: Date
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
credentialID?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
credentialURL?: string
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
@Column({ nullable: true })
|
||||
userId?: number
|
||||
|
||||
@Field(() => User, { nullable: true })
|
||||
@ManyToOne(() => User, user => user.qualifications, { onDelete: 'CASCADE' })
|
||||
user?: User
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
photo?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
photoUrl?: string
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Column, CreateDateColumn, Entity, JoinTable, ManyToMany, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
|
||||
import { Post, SpaceSubscription, User } from '@entities'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class Space extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number
|
||||
|
||||
@Field(() => String)
|
||||
@CreateDateColumn()
|
||||
createdAt?: Date
|
||||
|
||||
@Field(() => String)
|
||||
@UpdateDateColumn()
|
||||
updatedAt?: Date
|
||||
|
||||
@Field()
|
||||
@Column({ unique: true })
|
||||
spaceName!: string
|
||||
|
||||
@OneToMany(() => Post, post => post.space)
|
||||
posts?: Post[]
|
||||
|
||||
@OneToMany(() => SpaceSubscription, spaceSubscription => spaceSubscription.space)
|
||||
spaceSubscriptions?: SpaceSubscription[]
|
||||
|
||||
@Field(() => Boolean, { nullable: true })
|
||||
subscriptionStatus?: boolean
|
||||
|
||||
@Field(() => Int)
|
||||
subscriberNumber?: number
|
||||
|
||||
@Field(() => Boolean)
|
||||
modStatus?: boolean
|
||||
|
||||
@Field(() => [User], { nullable: true })
|
||||
@ManyToMany(() => User, { cascade: true })
|
||||
@JoinTable()
|
||||
mods?: User[]
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
avatar?: string // S3 Key (Location) to image
|
||||
|
||||
@Field({ nullable: true })
|
||||
avatarUrl?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
coverPhoto?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
coverPhotoUrl?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
fullSpaceName?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
rules?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
headline?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
about?: string
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Entity, ManyToOne, PrimaryColumn } from 'typeorm'
|
||||
import { Space, User } from '@entities'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class SpaceSubscription extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryColumn()
|
||||
userId!: number
|
||||
|
||||
@Field(() => User)
|
||||
@ManyToOne(() => User, user => user.spaceSubscriptions, { onDelete: 'CASCADE' })
|
||||
user?: User
|
||||
|
||||
@Field(() => Int)
|
||||
@PrimaryColumn()
|
||||
spaceId!: number
|
||||
|
||||
@Field(() => Space)
|
||||
@ManyToOne(() => Space, space => space.spaceSubscriptions, { onDelete: 'CASCADE' })
|
||||
space?: Space
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class Tag extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number
|
||||
|
||||
@Field()
|
||||
@Column()
|
||||
name: string
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
import { Comment, CommentVote, CV, EducationItem, Experience, Offer, OfferApplication, PageFollow, Post, Qualification, SpaceSubscription, UserFollow, Vote } from '@entities'
|
||||
import { Field, Float, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Column, CreateDateColumn, Entity, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class User extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
@CreateDateColumn()
|
||||
createdAt?: Date
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
@UpdateDateColumn()
|
||||
updatedAt?: Date
|
||||
|
||||
@Field()
|
||||
@Column({ unique: true, nullable: false })
|
||||
username?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ unique: true, nullable: false })
|
||||
email?: string
|
||||
|
||||
@Column({ nullable: false })
|
||||
password?: string
|
||||
|
||||
@OneToMany(() => Post, post => post.creator)
|
||||
posts?: Post[]
|
||||
|
||||
@OneToMany(() => Offer, offer => offer.creator)
|
||||
offers?: Offer[]
|
||||
|
||||
@OneToMany(() => EducationItem, educationItem => educationItem.user, { cascade: true })
|
||||
educationItems?: EducationItem[]
|
||||
|
||||
@OneToMany(() => Experience, experience => experience.user, { cascade: true })
|
||||
experiences?: Experience[]
|
||||
|
||||
@OneToMany(() => Qualification, qualification => qualification.user, { cascade: true })
|
||||
qualifications?: Qualification[]
|
||||
|
||||
@Field(() => [String], { nullable: true })
|
||||
@Column(`simple-array`, { nullable: true })
|
||||
skills?: string[]
|
||||
|
||||
@OneToMany(() => CV, cv => cv.user)
|
||||
cvs?: CV[]
|
||||
|
||||
@OneToMany(() => Vote, vote => vote.user)
|
||||
votes?: Vote[]
|
||||
|
||||
@OneToMany(() => SpaceSubscription, spaceSubscription => spaceSubscription.user)
|
||||
spaceSubscriptions?: SpaceSubscription[]
|
||||
|
||||
@OneToMany(() => PageFollow, pageFollow => pageFollow.user)
|
||||
pageFollows?: PageFollow[]
|
||||
|
||||
// One user can follow many
|
||||
@OneToMany(() => UserFollow, userFollow => userFollow.followingUser)
|
||||
userFollowings?: UserFollow[]
|
||||
|
||||
// One user can be followed by many
|
||||
@OneToMany(() => UserFollow, userFollow => userFollow.followedUser)
|
||||
userFolloweds?: PageFollow[]
|
||||
|
||||
@Field(() => [Comment], { nullable: true })
|
||||
@OneToMany(() => Comment, comment => comment.creator)
|
||||
comments?: Comment[]
|
||||
|
||||
@OneToMany(() => CommentVote, commentVote => commentVote.user)
|
||||
commentVotes?: CommentVote[]
|
||||
|
||||
@Field(() => [OfferApplication], { nullable: true })
|
||||
@OneToMany(() => OfferApplication, offerApplication => offerApplication.user)
|
||||
applications?: OfferApplication[]
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
avatar?: string // S3 Key (Location) to image
|
||||
|
||||
@Field({ nullable: true })
|
||||
avatarUrl?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
coverPhoto?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
coverPhotoUrl?: string
|
||||
|
||||
@Field(() => Int)
|
||||
followerNumber?: number
|
||||
|
||||
@Field(() => Int)
|
||||
followingNumber?: number
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
fullName?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
headline?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
address?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
about?: string
|
||||
|
||||
@Field(() => Float, { nullable: true })
|
||||
@Column({ type: 'float', nullable: true })
|
||||
mostRecentLatitude?: number
|
||||
|
||||
@Field(() => Float, { nullable: true })
|
||||
@Column({ type:'float', nullable: true })
|
||||
mostRecentLongitude?: number
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Entity, ManyToOne, PrimaryColumn } from 'typeorm'
|
||||
import { User } from './User'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class UserFollow extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@PrimaryColumn()
|
||||
followingUserId!: number
|
||||
|
||||
@Field(() => User)
|
||||
@ManyToOne(() => User, user => user.userFollowings, { onDelete: 'CASCADE' })
|
||||
followingUser?: User
|
||||
|
||||
@Field(() => Int)
|
||||
@PrimaryColumn()
|
||||
followedUserId!: number
|
||||
|
||||
@Field(() => User)
|
||||
@ManyToOne(() => User, user => user.userFolloweds, { onDelete: 'CASCADE' })
|
||||
followedUser?: User
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { Post, User } from '@entities'
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { BaseEntity, Column, Entity, ManyToOne, PrimaryColumn } from 'typeorm'
|
||||
|
||||
@ObjectType()
|
||||
@Entity()
|
||||
export class Vote extends BaseEntity {
|
||||
@Field(() => Int)
|
||||
@Column({ type: 'int' })
|
||||
value!: number
|
||||
|
||||
@Field(() => Int)
|
||||
@PrimaryColumn()
|
||||
userId!: number
|
||||
|
||||
@Field(() => User)
|
||||
@ManyToOne(() => User, user => user.votes, { onDelete: 'CASCADE' })
|
||||
user?: User
|
||||
|
||||
@Field(() => Int)
|
||||
@PrimaryColumn()
|
||||
postId!: number
|
||||
|
||||
@Field(() => Post)
|
||||
@ManyToOne(() => Post, post => post.votes, { onDelete: 'CASCADE' })
|
||||
post?: Post
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
export * from './User'
|
||||
export * from './Post'
|
||||
export * from './Vote'
|
||||
export * from './Space'
|
||||
export * from './SpaceSubscription'
|
||||
export * from './Comment'
|
||||
export * from './CommentVote'
|
||||
export * from './OfferApplication'
|
||||
export * from './Offer'
|
||||
export * from './Tag'
|
||||
export * from './Conversation'
|
||||
export * from './Page'
|
||||
export * from './PageFollow'
|
||||
export * from './UserFollow'
|
||||
export * from './EducationItem'
|
||||
export * from './Experience'
|
||||
export * from './Qualification'
|
||||
export * from './CV'
|
||||
Reference in New Issue
Block a user