mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-16 02:05:04 +01:00
24 lines
456 B
JavaScript
24 lines
456 B
JavaScript
import prisma from 'lib/prisma';
|
|
import redis from 'lib/redis';
|
|
|
|
export async function createWebsite(userId, data) {
|
|
return prisma.client.website
|
|
.create({
|
|
data: {
|
|
account: {
|
|
connect: {
|
|
id: userId,
|
|
},
|
|
},
|
|
...data,
|
|
},
|
|
})
|
|
.then(async res => {
|
|
if (redis.enabled && res) {
|
|
await redis.set(`website:${res.websiteUuid}`, res.id);
|
|
}
|
|
|
|
return res;
|
|
});
|
|
}
|