skailan-core
Version:
Servicio de autenticación y multitenancy para Skailan.
29 lines • 888 B
JavaScript
export class FeatureService {
static async listFeatures(prisma) {
return prisma.feature.findMany();
}
static async createFeature(prisma, name, description) {
// Generar un código único basado en el nombre
const code = name
.toLowerCase()
.replace(/\s+/g, "_")
.replace(/[^a-z0-9_]/g, "");
return prisma.feature.create({
data: {
name,
description: description || "",
code,
},
});
}
static async updateFeature(prisma, id, name, description) {
return prisma.feature.update({
where: { id },
data: { name, description },
});
}
static async deleteFeature(prisma, id) {
return prisma.feature.delete({ where: { id } });
}
}
//# sourceMappingURL=FeatureService.js.map