mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
23 lines
425 B
JavaScript
23 lines
425 B
JavaScript
import prisma from 'lib/prisma';
|
|
import cache from 'lib/cache';
|
|
|
|
export async function createWebsite(userId, data) {
|
|
return prisma.client.website
|
|
.create({
|
|
data: {
|
|
user: {
|
|
connect: {
|
|
id: userId,
|
|
},
|
|
},
|
|
...data,
|
|
},
|
|
})
|
|
.then(async data => {
|
|
if (cache.enabled) {
|
|
await cache.storeWebsite(data);
|
|
}
|
|
|
|
return data;
|
|
});
|
|
}
|