Browse Source

revert some more code, add comments

pull/1719/head
Bernd Storath 5 months ago
parent
commit
c27cd83bd3
  1. 1
      src/server/database/repositories/hooks/schema.ts
  2. 1
      src/server/database/repositories/oneTimeLink/schema.ts
  3. 6
      src/server/database/repositories/oneTimeLink/service.ts
  4. 1
      src/server/database/repositories/userConfig/schema.ts

1
src/server/database/repositories/hooks/schema.ts

@ -4,6 +4,7 @@ import { sqliteTable, text } from 'drizzle-orm/sqlite-core';
import { wgInterface } from '../../schema'; import { wgInterface } from '../../schema';
export const hooks = sqliteTable('hooks_table', { export const hooks = sqliteTable('hooks_table', {
/** same as `wgInterface.name` */
id: text() id: text()
.primaryKey() .primaryKey()
.references(() => wgInterface.name, { .references(() => wgInterface.name, {

1
src/server/database/repositories/oneTimeLink/schema.ts

@ -4,6 +4,7 @@ import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core';
import { client } from '../../schema'; import { client } from '../../schema';
export const oneTimeLink = sqliteTable('one_time_links_table', { export const oneTimeLink = sqliteTable('one_time_links_table', {
/** same as `client.id` */
id: int() id: int()
.primaryKey() .primaryKey()
.references(() => client.id, { .references(() => client.id, {

6
src/server/database/repositories/oneTimeLink/service.ts

@ -50,11 +50,7 @@ export class OneTimeLinkService {
const oneTimeLink = Math.abs(CRC32.str(key)).toString(16); const oneTimeLink = Math.abs(CRC32.str(key)).toString(16);
const expiresAt = new Date(Date.now() + 5 * 60 * 1000).toISOString(); const expiresAt = new Date(Date.now() + 5 * 60 * 1000).toISOString();
return this.#statements.create.execute({ return this.#statements.create.execute({ id, oneTimeLink, expiresAt });
id,
oneTimeLink,
expiresAt,
});
} }
erase(id: ID) { erase(id: ID) {

1
src/server/database/repositories/userConfig/schema.ts

@ -5,6 +5,7 @@ import { wgInterface } from '../../schema';
// default* means clients store it themselves // default* means clients store it themselves
export const userConfig = sqliteTable('user_configs_table', { export const userConfig = sqliteTable('user_configs_table', {
/** same as `wgInterface.name` */
id: text() id: text()
.primaryKey() .primaryKey()
.references(() => wgInterface.name, { .references(() => wgInterface.name, {

Loading…
Cancel
Save