delete user leantime api 8

This commit is contained in:
Alma 2025-04-10 22:05:48 +02:00
parent 55652a92d6
commit 4f36652843
2 changed files with 2 additions and 4 deletions

View File

@ -32,7 +32,7 @@ async function deleteLeantimeUser(email: string): Promise<{ success: boolean; er
}
// Find the user with matching email
const user = getUsersData.result.find((u: any) => u.email === email);
const user = getUsersData.result.find((u: any) => u.username === email);
if (!user) {
console.log('User not found in Leantime, might have been already deleted');
return { success: true }; // Consider it a success if user doesn't exist

View File

@ -202,7 +202,6 @@ function validateUsername(username: string): { isValid: boolean; error?: string
// Helper function to create user in Leantime
async function createLeantimeUser(userData: {
username: string;
firstName: string;
lastName: string;
email: string;
@ -230,7 +229,7 @@ async function createLeantimeUser(userData: {
jsonrpc: '2.0',
id: 1,
params: {
values: {
user: {
firstname: userData.firstName,
lastname: userData.lastName,
email: userData.email,
@ -444,7 +443,6 @@ export async function POST(req: Request) {
// Create user in Leantime
const leantimeResult = await createLeantimeUser({
username: data.username,
firstName: data.firstName,
lastName: data.lastName,
email: data.email,