33 lines
782 B
TypeScript
33 lines
782 B
TypeScript
import {
|
|
Entity,
|
|
Column,
|
|
PrimaryColumn,
|
|
Index,
|
|
ManyToOne,
|
|
OneToMany,
|
|
} from "typeorm";
|
|
import { Account } from "./account.js";
|
|
import { Post } from "./post.js";
|
|
|
|
@Entity()
|
|
@Index(["username", "host"], { unique: true })
|
|
export class Blog {
|
|
@PrimaryColumn("text")
|
|
id: string;
|
|
@Column("text", { nullable: true, unique: true, comment: "ActivityPub ID" })
|
|
apId: string | null;
|
|
@Column("text", { nullable: false })
|
|
username: string;
|
|
@Column("text", { nullable: true })
|
|
host: string | null;
|
|
|
|
@ManyToOne(() => Account, (account) => account.blogs)
|
|
account: Account;
|
|
@OneToMany(() => Post, (post) => post.blog)
|
|
posts: Post[];
|
|
|
|
@Column("text", { nullable: false })
|
|
publicKey: string;
|
|
@Column("text", { nullable: true })
|
|
privateKey: string | null;
|
|
}
|