import { client } from './client'; export async function remove(projectId: string): Promise { const editor = await get(projectId); if (editor) { return client.users.destroy(editor.id); } else { return 'No editor for projectId'; } } export async function get(projectId: string): Promise { const allEditors = await client.users.all(); const editor = allEditors.find((foundEditor: any) => { console.log(JSON.stringify(foundEditor, null, 4)); return foundEditor.firstName === projectId; }); if (editor) { console.log('got editor for projectId', projectId); } else { console.error('Couldnt find editor for projectId', projectId); } return editor; } exports.remove = remove; exports.get = get;