-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn } from 'typeorm'; | ||
import Visiter from './Visiter'; | ||
import Host from './Host'; | ||
|
||
@Entity() | ||
export default class Connection { | ||
@PrimaryGeneratedColumn() id: number; | ||
|
||
/** 请求文件 */ | ||
@Column() asset: string; | ||
|
||
/** 请求方法 */ | ||
@Column() method: string; | ||
|
||
/** 状态 */ | ||
@Column() status: number; | ||
|
||
/** 文件地址 */ | ||
@Column() uri: string; | ||
|
||
/** 文件大小 */ | ||
@Column() size: string; | ||
|
||
/** 访客 ID */ | ||
@Column() visiterId: number; | ||
|
||
@ManyToOne(type => Visiter) | ||
@JoinColumn({ name: 'visiterId' }) | ||
visiter: Visiter; | ||
|
||
/** 访问的网站 */ | ||
@Column() hostId: number; | ||
|
||
@ManyToOne(type => Host) | ||
@JoinColumn({ name: 'hostId' }) | ||
host: Host; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Column, Entity, PrimaryGeneratedColumn, OneToOne, JoinColumn } from 'typeorm'; | ||
import User from './User'; | ||
|
||
@Entity() | ||
export default class Host { | ||
@PrimaryGeneratedColumn() id: number; | ||
|
||
/** 网站 */ | ||
@Column() website: string; | ||
|
||
/** 所属用户 ID */ | ||
@Column() userId: number; | ||
|
||
/** 所属用户 */ | ||
@OneToOne(type => User) | ||
@JoinColumn({ name: 'userId' }) | ||
user: User; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Entity, PrimaryGeneratedColumn } from 'typeorm'; | ||
|
||
@Entity() | ||
export default class Page { | ||
@PrimaryGeneratedColumn() id: number; | ||
|
||
/** */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Column, Entity, PrimaryColumn, CreateDateColumn, ManyToOne, JoinColumn } from 'typeorm'; | ||
import Visiter from './Visiter'; | ||
import Host from './Host'; | ||
|
||
@Entity() | ||
export default class Session { | ||
@PrimaryColumn() visiterId: number; | ||
|
||
@PrimaryColumn() hostId: number; | ||
|
||
/** referer */ | ||
@Column() referer: string; | ||
|
||
/** 访问时间 */ | ||
@CreateDateColumn() createdAt: string; | ||
|
||
@ManyToOne(type => Visiter) | ||
@JoinColumn({ name: 'visiterId' }) | ||
visiter: Visiter; | ||
|
||
@ManyToOne(type => Host) | ||
@JoinColumn({ name: 'hostId' }) | ||
host: Host; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; | ||
|
||
@Entity() | ||
export default class User { | ||
@PrimaryGeneratedColumn() id: number; | ||
|
||
/** 用户邮箱 */ | ||
@Column() email: string; | ||
|
||
/** 用户密码 */ | ||
@Column() password: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Column, Entity, PrimaryGeneratedColumn, CreateDateColumn } from 'typeorm'; | ||
|
||
@Entity() | ||
export default class Visiter { | ||
@PrimaryGeneratedColumn() id: number; | ||
|
||
/** 语言 */ | ||
@Column() lang: string; | ||
|
||
/** 地区 */ | ||
@Column() location: string; | ||
|
||
/** 城市 */ | ||
@Column() city: string; | ||
|
||
/** 浏览器信息 */ | ||
@Column() browser: string; | ||
|
||
/** 操作系统 */ | ||
@Column() os: string; | ||
|
||
/** 创建时间 */ | ||
@CreateDateColumn() createdAt: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters