Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
feat: add entities
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-rustin committed Sep 22, 2020
1 parent edb7514 commit 2d21333
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 1 deletion.
Empty file removed src/db/.keep
Empty file.
31 changes: 31 additions & 0 deletions src/db/entities/ContributorInfo.ts
@@ -0,0 +1,31 @@
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity({ name: "contributor_info" })
export class ContributorInfo {
@PrimaryGeneratedColumn({ name: "id" })
id: number;

@Column({ default: null, unique: true })
github: string;

@Column({ default: null })
name: string;

@Column({ default: null })
email: string;

@Column({ default: null })
location: string;

@Column({ default: null })
tel: string;

@Column({ default: null })
other: string;

@Column({ default: null })
company: string;

@Column({ default: null })
tp: string;
}
40 changes: 40 additions & 0 deletions src/db/entities/Sig.ts
@@ -0,0 +1,40 @@
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";

// FIXME: it should be sigs.
@Entity({ name: "sig" })
export class Sig {
@PrimaryGeneratedColumn({ name: "id" })
id: number;

@Column({ nullable: true, default: null, unique: true })
name: string;

@Column({ nullable: true, default: null })
info: string;

@Column({ name: "sig_url", nullable: true, default: null })
sigUrl: string;

@Column({
name: "create_time",
nullable: false,
default: () => "CURRENT_TIMESTAMP",
})
createTime: Date;

@Column({ nullable: true, default: null })
channel: string;

@Column({
name: "update_time",
nullable: false,
default: () => "CURRENT_TIMESTAMP",
})
updateTime: Date;

@Column({ nullable: false, default: 0 })
status: number;

@Column({ nullable: true, default: 2 })
lgtm: number;
}
35 changes: 35 additions & 0 deletions src/db/entities/SigMember.ts
@@ -0,0 +1,35 @@
import { Column, Entity, PrimaryGeneratedColumn, Unique } from "typeorm";

// FIXME: it should be sig_members.
@Entity({ name: "sig_member" })
@Unique("sig_id", ["sig_id", "contributor_id"])
export class SigMember {
@PrimaryGeneratedColumn({ name: "id" })
id: number;

@Column({ name: "sig_id", default: null })
sigId: number;

@Column({ name: "contributor_id", default: null })
contributorId: number;

@Column({ default: null })
level: string;

@Column({
name: "create_time",
nullable: false,
default: () => "CURRENT_TIMESTAMP",
})
createTime: Date;

@Column({
name: "update_time",
nullable: false,
default: () => "CURRENT_TIMESTAMP",
})
updateTime: Date;

@Column({ nullable: false, default: 0 })
status: number;
}
2 changes: 1 addition & 1 deletion tsconfig.json
Expand Up @@ -32,7 +32,7 @@
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
"strictPropertyInitialization": false /* Enable strict checking of property initialization in classes. */,
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */

Expand Down

0 comments on commit 2d21333

Please sign in to comment.