Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: posts api #4075

Merged
merged 14 commits into from
Jul 25, 2024
47 changes: 47 additions & 0 deletions packages/api/src/entity/post.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {
Column,
CreateDateColumn,
Entity,
JoinColumn,
ManyToOne,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm'
import { User } from './user'

@Entity({ name: 'post' })
export class Post {
@PrimaryGeneratedColumn('uuid')
id!: string

@Column('uuid')
userId!: string

@ManyToOne(() => User)
@JoinColumn({ name: 'user_id' })
user!: User

@Column('uuid', { array: true })
libraryItemIds!: string[]

@Column('uuid', { array: true, nullable: true })
highlightIds?: string[] | null

@Column('text')
title!: string

@Column('text')
content!: string

@Column('text', { nullable: true })
thumbnail?: string | null

@Column('text', { nullable: true })
thought?: string | null

@CreateDateColumn({ type: 'timestamptz' })
createdAt!: Date

@UpdateDateColumn({ type: 'timestamptz' })
updatedAt!: Date
}
Loading
Loading