redis checkpoint

This commit is contained in:
Brian Cao 2022-08-26 20:21:53 -07:00
parent 10cc6616c5
commit 818f8721e9
10 changed files with 187 additions and 34 deletions

View file

@ -1,4 +1,5 @@
import { prisma, runQuery } from 'lib/relational';
import redis from 'lib/redis';
export async function createWebsite(user_id, data) {
return runQuery(
@ -12,5 +13,11 @@ export async function createWebsite(user_id, data) {
...data,
},
}),
);
).then(async res => {
if (process.env.REDIS_URL) {
await redis.set(`website:${res.website_uuid}`, Number(res.website_id));
}
return res;
});
}