umami/queries/admin/website/createWebsite.js
2022-08-29 10:47:01 -07:00

24 lines
479 B
JavaScript

import prisma from 'lib/prisma';
import redis from 'lib/redis';
export async function createWebsite(user_id, data) {
return prisma.client.website
.create({
data: {
account: {
connect: {
user_id,
},
},
...data,
},
})
.then(async res => {
if (process.env.REDIS_URL && res) {
await redis.set(`website:${res.website_uuid}`, Number(res.website_id));
}
return res;
});
}