mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
feat: implement long-lived sessions
This commit is contained in:
parent
d0705afca8
commit
44f7e26270
35 changed files with 739 additions and 190 deletions
26
src/auth/auth-session.entity.ts
Normal file
26
src/auth/auth-session.entity.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
} from "typeorm";
|
||||
import { User } from "../users/user.entity";
|
||||
|
||||
@Entity()
|
||||
export class AuthSession {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@ManyToOne((type) => User, { eager: true })
|
||||
user: User;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
@Column({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
||||
lastUsedAt: Date;
|
||||
|
||||
@Column({ type: "timestamp", nullable: true })
|
||||
revokedAt: Date | null;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue