mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2025-10-03 01:39:31 +02:00
Compare commits
4 commits
d227f112e4
...
24fa354f09
Author | SHA1 | Date | |
---|---|---|---|
![]() |
24fa354f09 | ||
![]() |
3d307bee6e | ||
![]() |
9c2048af64 | ||
![]() |
b69271f7df |
4 changed files with 1130 additions and 4169 deletions
5250
package-lock.json
generated
5250
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -38,12 +38,11 @@
|
|||
"@types/lodash": "^4.14.166",
|
||||
"@types/node": "^16.11.59",
|
||||
"@types/nodemailer": "^6.4.4",
|
||||
"@types/umzug": "^2.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
||||
"@typescript-eslint/parser": "^5.10.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||
"@typescript-eslint/parser": "^7.18.0",
|
||||
"eslint": "^8.7.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^4.4.4",
|
||||
"typescript": "^5.5.4",
|
||||
"typescript-json-schema": "^0.52.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -64,7 +63,7 @@
|
|||
"rate-limiter-flexible": "^2.1.15",
|
||||
"sequelize": "^6.25.5",
|
||||
"socket.io": "^4.0.1",
|
||||
"umzug": "^2.3.0"
|
||||
"umzug": "^3.8.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"sqlite3": "^5.0.0"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2024 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -26,7 +26,7 @@ export const config = {
|
|||
expireTimeRounding: 1000 * 60 * 15
|
||||
}
|
||||
|
||||
export function calculateExpireTime(now: bigint): BigInt {
|
||||
export function calculateExpireTime(now: bigint): bigint {
|
||||
const expireBaseTime = now + BigInt(config.expireDelay)
|
||||
const expireTime = expireBaseTime - expireBaseTime % BigInt(config.expireTimeRounding) + BigInt(config.expireTimeRounding)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2024 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -17,18 +17,26 @@
|
|||
|
||||
import { resolve } from 'path'
|
||||
import { Sequelize } from 'sequelize'
|
||||
import * as Umzug from 'umzug'
|
||||
import { Umzug, SequelizeStorage } from 'umzug'
|
||||
|
||||
export const createUmzug = (sequelize: Sequelize) => (
|
||||
new Umzug({
|
||||
storage: 'sequelize',
|
||||
storageOptions: {
|
||||
sequelize
|
||||
},
|
||||
storage: new SequelizeStorage({ sequelize }),
|
||||
migrations: {
|
||||
params: [sequelize.getQueryInterface(), sequelize],
|
||||
path: resolve(__dirname, '../../../build/database/migration/migrations'),
|
||||
pattern: /^\d+[\w-]+\.js$/
|
||||
glob: resolve(__dirname, '../../../build/database/migration/migrations/*.js'),
|
||||
resolve: ({ name, path }) => {
|
||||
if (!path) throw new Error()
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const migration = require(path)
|
||||
|
||||
return {
|
||||
name,
|
||||
up: async () => migration.up(sequelize.getQueryInterface(), sequelize),
|
||||
down: async () => migration.down(sequelize.getQueryInterface(), sequelize),
|
||||
}
|
||||
},
|
||||
},
|
||||
logger: console
|
||||
})
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue