From fd782219eff8016a00e87f0c8e44af3a3ba74be6 Mon Sep 17 00:00:00 2001 From: Max Isom Date: Sun, 19 Sep 2021 22:04:34 -0400 Subject: Move to ESM, use ytsr, implement caching Closes #315 --- src/models/cache.ts | 15 +++++++++++++++ src/models/index.ts | 6 ++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 src/models/cache.ts (limited to 'src/models') diff --git a/src/models/cache.ts b/src/models/cache.ts new file mode 100644 index 0000000..ebf8dad --- /dev/null +++ b/src/models/cache.ts @@ -0,0 +1,15 @@ +import {Table, Column, PrimaryKey, Model} from 'sequelize-typescript'; +import sequelize from 'sequelize'; + +@Table +export default class Cache extends Model { + @PrimaryKey + @Column + key!: string; + + @Column(sequelize.TEXT) + value!: string; + + @Column + expiresAt!: Date; +} diff --git a/src/models/index.ts b/src/models/index.ts index 2971df5..b0cd909 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -1,7 +1,9 @@ -import Settings from './settings'; -import Shortcut from './shortcut'; +import Cache from './cache.js'; +import Settings from './settings.js'; +import Shortcut from './shortcut.js'; export { + Cache, Settings, Shortcut }; -- cgit v1.2.3