-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathUser.ts
More file actions
32 lines (26 loc) · 736 Bytes
/
User.ts
File metadata and controls
32 lines (26 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import {Collection, type Opt} from "@mikro-orm/core"
import {
Embedded,
Entity,
OneToMany,
Property,
Unique
} from "@mikro-orm/decorators/legacy"
import type {User as DatabaseUser} from "better-auth"
import {Base} from "../shared/Base.js"
import {Address} from "./Address.js"
import {Session} from "./Session.js"
@Entity()
export class User extends Base implements DatabaseUser {
@Property({type: "string"})
@Unique()
email!: string
@Property({type: "boolean"})
emailVerified: Opt<boolean> = false
@Property({type: "string"})
name!: string
@OneToMany(() => Session, "user")
sessions = new Collection<Session, this>(this)
@Embedded(() => Address, {object: true, nullable: true})
address?: Address
}