a lot of things

This commit is contained in:
2026-02-20 11:46:30 -06:00
parent 987a1c8a6a
commit 70284bc14e
37 changed files with 1080 additions and 79 deletions
+4
View File
@@ -79,6 +79,8 @@ export const credentialTypes = {
});
}
console.log(data.fields);
const credentialType = await prisma.credentialType.create({
data: {
name: data.name,
@@ -91,6 +93,8 @@ export const credentialTypes = {
},
});
console.log(credentialType.fields);
return new CredentialTypeController(credentialType);
},
+2
View File
@@ -73,6 +73,7 @@ export const credentials = {
*/
async create(data: {
name: string;
notes?: string;
typeId: string;
companyId: string;
fields: {
@@ -131,6 +132,7 @@ export const credentials = {
const credential = await prisma.credential.create({
data: {
name: data.name,
notes: data.notes,
typeId: data.typeId,
companyId: data.companyId,
fields: fieldsObject,
+27 -4
View File
@@ -106,8 +106,31 @@ export const users = {
return controller;
},
};
/**
* @TODO Figure out default permissions
*/
/**
* Fetch all users
*
* Returns an array of UserController instances for every user in the database.
*
* @returns {Promise<UserController[]>} Array of user controllers
*/
async fetchAllUsers(): Promise<UserController[]> {
const allUsers = await prisma.user.findMany({
include: { roles: true },
});
return allUsers.map((u) => new UserController(u));
},
/**
* Delete a user
*
* Removes a user record from the database by their id.
*
* @param userId - The id of the user to delete
*/
async deleteUser(userId: string): Promise<void> {
await prisma.user.delete({ where: { id: userId } });
events.emit("user:deleted", { id: userId });
},
};