aboutsummaryrefslogtreecommitdiff
path: root/src/models
diff options
context:
space:
mode:
authorMax Isom <[email protected]>2021-09-19 22:04:34 -0400
committerMax Isom <[email protected]>2021-09-19 22:09:09 -0400
commitfd782219eff8016a00e87f0c8e44af3a3ba74be6 (patch)
tree2de37667318794427406b45848a7bf699c9e1a6f /src/models
parentefcdeb78c8b690bc544dac1ed0be96a6693bcff6 (diff)
downloadmuse-fd782219eff8016a00e87f0c8e44af3a3ba74be6.tar.xz
muse-fd782219eff8016a00e87f0c8e44af3a3ba74be6.zip
Move to ESM, use ytsr, implement caching
Closes #315
Diffstat (limited to 'src/models')
-rw-r--r--src/models/cache.ts15
-rw-r--r--src/models/index.ts6
2 files changed, 19 insertions, 2 deletions
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<Cache> {
+ @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
};