revert!: simplify create users by removing group option

This commit is contained in:
Julien Oculi 2024-01-15 22:12:30 +01:00
parent 77c21dd292
commit b62dbe9038

View file

@ -5,10 +5,7 @@ import { capitalize, log, sanitize, toLogin } from '../utils.ts'
async function createUsers( async function createUsers(
redmine: Redmine, redmine: Redmine,
csv: CsvEntry[], csv: CsvEntry[],
groupName: string,
) { ) {
const userIds: number[] = []
for (const { firstname, lastname, mail } of csv) { for (const { firstname, lastname, mail } of csv) {
const login = toLogin(firstname, lastname) const login = toLogin(firstname, lastname)
@ -23,21 +20,9 @@ async function createUsers(
}) })
log.info(`create user ${login}#${user.id}`) log.info(`create user ${login}#${user.id}`)
userIds.push(user.id)
} catch (error) { } catch (error) {
log.error(`create user ${login}`) log.error(`create user ${login}`)
console.error(error) console.error(error)
} }
} }
try {
log.info(`add to "${groupName}" users [${userIds.join(', ')}]`)
await redmine.unstableGroups.create({
name: 'entrepreneur-01-24',
userIds,
})
} catch (error) {
log.error(`add to "${groupName}" users [${userIds.join(', ')}]`)
console.error(error)
}
} }