mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 17:55:17 -04:00
Implement User entity.
This commit implements the User entity according to the database schema and adds the Identity and AuthToken entities. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
db026d6a57
commit
8689b44f59
4 changed files with 117 additions and 2 deletions
|
@ -1,8 +1,51 @@
|
|||
import { Entity, PrimaryGeneratedColumn } from 'typeorm';
|
||||
import { Column, OneToMany } from 'typeorm/index';
|
||||
import { Note } from '../notes/note.entity';
|
||||
import { AuthToken } from './auth-token.entity';
|
||||
import { Identity } from './identity.entity';
|
||||
|
||||
@Entity()
|
||||
export class User {
|
||||
//TODO: Still missing many properties
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column()
|
||||
userName: string;
|
||||
|
||||
@Column()
|
||||
displayName: string;
|
||||
|
||||
@Column()
|
||||
createdAt: Date;
|
||||
|
||||
@Column()
|
||||
updatedAt: Date;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
})
|
||||
photo?: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
})
|
||||
email?: string;
|
||||
|
||||
@OneToMany(
|
||||
_ => Note,
|
||||
note => note.owner,
|
||||
)
|
||||
ownedNotes: Note[];
|
||||
|
||||
@OneToMany(
|
||||
_ => AuthToken,
|
||||
authToken => authToken.user,
|
||||
)
|
||||
authToken: AuthToken[];
|
||||
|
||||
@OneToMany(
|
||||
_ => Identity,
|
||||
identity => identity.user,
|
||||
)
|
||||
identities: Identity[];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue