mirror of https://github.com/MaxLeiter/Drift
server: add JWTDenyList table and signout route (#52)
* add models and signout route * add migration file for JWTDenylist Closes #25 Co-authored-by: Max Leiter <maxwell.leiter@gmail.com>pull/80/head
parent
9cbcfd3397
commit
b6439858df
@ -0,0 +1,42 @@
|
|||||||
|
import {
|
||||||
|
Model,
|
||||||
|
Column,
|
||||||
|
Table,
|
||||||
|
IsUUID,
|
||||||
|
PrimaryKey,
|
||||||
|
DataType,
|
||||||
|
CreatedAt,
|
||||||
|
UpdatedAt,
|
||||||
|
DeletedAt,
|
||||||
|
Unique
|
||||||
|
} from "sequelize-typescript"
|
||||||
|
|
||||||
|
@Table
|
||||||
|
export class JWTDenyList extends Model {
|
||||||
|
@IsUUID(4)
|
||||||
|
@PrimaryKey
|
||||||
|
@Unique
|
||||||
|
@Column({
|
||||||
|
type: DataType.UUID,
|
||||||
|
defaultValue: DataType.UUIDV4
|
||||||
|
})
|
||||||
|
id!: string
|
||||||
|
|
||||||
|
@Column
|
||||||
|
token!: string
|
||||||
|
|
||||||
|
@Column
|
||||||
|
reason!: string
|
||||||
|
|
||||||
|
@CreatedAt
|
||||||
|
@Column
|
||||||
|
createdAt!: Date
|
||||||
|
|
||||||
|
@UpdatedAt
|
||||||
|
@Column
|
||||||
|
updatedAt!: Date
|
||||||
|
|
||||||
|
@DeletedAt
|
||||||
|
@Column
|
||||||
|
deletedAt?: Date
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
"use strict"
|
||||||
|
import { DataTypes } from "sequelize"
|
||||||
|
import type { Migration } from "../database"
|
||||||
|
|
||||||
|
export const up: Migration = async ({ context: queryInterface }) =>
|
||||||
|
queryInterface.createTable("JWTDenyLists", {
|
||||||
|
id: {
|
||||||
|
type: DataTypes.UUID,
|
||||||
|
defaultValue: DataTypes.UUIDV4,
|
||||||
|
primaryKey: true,
|
||||||
|
unique: true
|
||||||
|
},
|
||||||
|
token: {
|
||||||
|
type: DataTypes.STRING
|
||||||
|
},
|
||||||
|
reason: {
|
||||||
|
type: DataTypes.STRING
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: DataTypes.DATE
|
||||||
|
},
|
||||||
|
updatedAt: {
|
||||||
|
type: DataTypes.DATE
|
||||||
|
},
|
||||||
|
deletedAt: {
|
||||||
|
type: DataTypes.DATE
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export const down: Migration = async ({ context: queryInterface }) =>
|
||||||
|
queryInterface.dropTable("JWTDenyLists")
|
||||||
Loading…
Reference in New Issue