a lot of things
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
||||
|
||||
@@ -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
@@ -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 });
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user