refactor(database): 🎨 Improve database handlers to have more consistent naming and methods

This commit is contained in:
Jesse Wierzbinski 2024-06-12 14:45:07 -10:00
parent a6159b9d55
commit 5565bf00de
No known key found for this signature in database
47 changed files with 365 additions and 333 deletions

View file

@ -118,13 +118,13 @@ export default class UserCreate extends BaseCommand<typeof UserCreate> {
!flags.format &&
this.log(
`${chalk.green("✓")} Created user ${chalk.green(
user.getUser().username,
user.data.username,
)} with id ${chalk.green(user.id)}`,
);
this.log(
formatArray(
[user.getUser()],
[user.data],
[
"id",
"username",
@ -144,7 +144,7 @@ export default class UserCreate extends BaseCommand<typeof UserCreate> {
flags.format
? link
: `\nPassword reset link for ${chalk.bold(
`@${user.getUser().username}`,
`@${user.data.username}`,
)}: ${chalk.underline(chalk.blue(link))}\n`,
);

View file

@ -50,7 +50,7 @@ export default class UserDelete extends UserFinderCommand<typeof UserDelete> {
flags.print &&
this.log(
formatArray(
users.map((u) => u.getUser()),
users.map((u) => u.data),
[
"id",
"username",

View file

@ -72,7 +72,7 @@ export default class UserList extends BaseCommand<typeof UserList> {
this.log(
formatArray(
users.map((u) => u.getUser()),
users.map((u) => u.data),
keys,
flags.format as "json" | "csv" | undefined,
flags["pretty-dates"],

View file

@ -53,7 +53,7 @@ export default class UserRefetch extends UserFinderCommand<typeof UserRefetch> {
flags.print &&
this.log(
formatArray(
users.map((u) => u.getUser()),
users.map((u) => u.data),
[
"id",
"username",
@ -85,7 +85,7 @@ export default class UserRefetch extends UserFinderCommand<typeof UserRefetch> {
this.log(
chalk.bold(
`${chalk.red("✗")} Failed to refetch user ${
user.getUser().username
user.data.username
}`,
),
);

View file

@ -60,7 +60,7 @@ export default class UserReset extends UserFinderCommand<typeof UserReset> {
flags.print &&
this.log(
formatArray(
users.map((u) => u.getUser()),
users.map((u) => u.data),
[
"id",
"username",
@ -108,7 +108,7 @@ export default class UserReset extends UserFinderCommand<typeof UserReset> {
flags.raw
? link
: `\nPassword reset link for ${chalk.bold(
`@${user.getUser().username}`,
`@${user.data.username}`,
)}: ${chalk.underline(chalk.blue(link))}\n`,
);