users: rename "add_user" to "add" and "get_data" to "get"

This commit is contained in:
Daniel Friesel 2023-01-22 12:44:19 +01:00
parent e98fc8493f
commit 1c63574245
No known key found for this signature in database
GPG key ID: 100D5BFB5166E005
4 changed files with 8 additions and 8 deletions

View file

@ -821,7 +821,7 @@ sub startup {
$uid //= $self->current_user->{id};
return $self->users->get_data( uid => $uid );
return $self->users->get( uid => $uid );
}
);

View file

@ -5,7 +5,7 @@ package Travelynx::Command::account;
# SPDX-License-Identifier: AGPL-3.0-or-later
use Mojo::Base 'Mojolicious::Command';
use Crypt::Eksblowfish::Bcrypt qw(bcrypt en_base64);
use UUID::Tiny qw(:std);
use UUID::Tiny qw(:std);
has description => 'Add or remove user accounts';
@ -34,7 +34,7 @@ sub add_user {
my $password_hash = hash_password($password);
my $tx = $db->begin;
my $user_id = $self->app->users->add_user(
my $user_id = $self->app->users->add(
db => $db,
name => $name,
email => $email,
@ -58,7 +58,7 @@ sub add_user {
sub delete_user {
my ( $self, $uid ) = @_;
my $user_data = $self->app->users->get_data( uid => $uid );
my $user_data = $self->app->users->get( uid => $uid );
if ( not $user_data ) {
say "UID $uid does not exist.";
@ -73,7 +73,7 @@ sub delete_user {
sub really_delete_user {
my ( $self, $uid, $name ) = @_;
my $user_data = $self->app->users->get_data( uid => $uid );
my $user_data = $self->app->users->get( uid => $uid );
if ( $user_data->{name} ne $name ) {
say

View file

@ -337,7 +337,7 @@ sub register {
my $pw_hash = hash_password($password);
my $db = $self->pg->db;
my $tx = $db->begin;
my $user_id = $self->users->add_user(
my $user_id = $self->users->add(
db => $db,
name => $user,
email => $email,

View file

@ -318,7 +318,7 @@ sub remove_password_token {
);
}
sub get_data {
sub get {
my ( $self, %opt ) = @_;
my $db = $opt{db} // $self->{pg}->db;
my $uid = $opt{uid};
@ -377,7 +377,7 @@ sub get_login_data {
return $res_h;
}
sub add_user {
sub add {
my ( $self, %opt ) = @_;
my $db = $opt{db} // $self->{pg}->db;
my $user_name = $opt{name};