umami/queries/admin/website/getWebsiteByUuid.js

19 lines
396 B
JavaScript
Raw Normal View History

2022-08-28 06:38:35 +02:00
import prisma from 'lib/prisma';
2022-08-29 19:47:01 +02:00
import redis from 'lib/redis';
2022-07-12 23:14:36 +02:00
export async function getWebsiteByUuid(website_uuid) {
2022-08-29 19:47:01 +02:00
return prisma.client.website
.findUnique({
where: {
website_uuid,
},
})
.then(async res => {
2022-08-29 22:04:58 +02:00
if (redis.client && res) {
await redis.client.set(`website:${res.website_uuid}`, res.website_id);
2022-08-29 19:47:01 +02:00
}
return res;
});
2022-07-12 23:14:36 +02:00
}