delete user leantime api 8
This commit is contained in:
parent
55652a92d6
commit
4f36652843
@ -32,7 +32,7 @@ async function deleteLeantimeUser(email: string): Promise<{ success: boolean; er
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find the user with matching email
|
// 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) {
|
if (!user) {
|
||||||
console.log('User not found in Leantime, might have been already deleted');
|
console.log('User not found in Leantime, might have been already deleted');
|
||||||
return { success: true }; // Consider it a success if user doesn't exist
|
return { success: true }; // Consider it a success if user doesn't exist
|
||||||
|
|||||||
@ -202,7 +202,6 @@ function validateUsername(username: string): { isValid: boolean; error?: string
|
|||||||
|
|
||||||
// Helper function to create user in Leantime
|
// Helper function to create user in Leantime
|
||||||
async function createLeantimeUser(userData: {
|
async function createLeantimeUser(userData: {
|
||||||
username: string;
|
|
||||||
firstName: string;
|
firstName: string;
|
||||||
lastName: string;
|
lastName: string;
|
||||||
email: string;
|
email: string;
|
||||||
@ -230,7 +229,7 @@ async function createLeantimeUser(userData: {
|
|||||||
jsonrpc: '2.0',
|
jsonrpc: '2.0',
|
||||||
id: 1,
|
id: 1,
|
||||||
params: {
|
params: {
|
||||||
values: {
|
user: {
|
||||||
firstname: userData.firstName,
|
firstname: userData.firstName,
|
||||||
lastname: userData.lastName,
|
lastname: userData.lastName,
|
||||||
email: userData.email,
|
email: userData.email,
|
||||||
@ -444,7 +443,6 @@ export async function POST(req: Request) {
|
|||||||
|
|
||||||
// Create user in Leantime
|
// Create user in Leantime
|
||||||
const leantimeResult = await createLeantimeUser({
|
const leantimeResult = await createLeantimeUser({
|
||||||
username: data.username,
|
|
||||||
firstName: data.firstName,
|
firstName: data.firstName,
|
||||||
lastName: data.lastName,
|
lastName: data.lastName,
|
||||||
email: data.email,
|
email: data.email,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user