summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Model
diff options
context:
space:
mode:
authorDerf Null <derf@finalrewind.org>2023-06-04 14:28:04 +0200
committerDerf Null <derf@finalrewind.org>2023-06-04 14:28:04 +0200
commit0172f0ce8ac543d287fef02786960d3e980556f4 (patch)
treeb164d901bfe11ac9842e9cc344569d4764558440 /lib/Travelynx/Model
parentd4a647014194d635d1025f83e595138c71db9c1d (diff)
add profile editor
Diffstat (limited to 'lib/Travelynx/Model')
-rw-r--r--lib/Travelynx/Model/Users.pm24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/Travelynx/Model/Users.pm b/lib/Travelynx/Model/Users.pm
index fbd53fd..7326e34 100644
--- a/lib/Travelynx/Model/Users.pm
+++ b/lib/Travelynx/Model/Users.pm
@@ -750,6 +750,30 @@ sub update_webhook_status {
);
}
+sub set_profile {
+ my ( $self, %opt ) = @_;
+
+ my $db = $opt{db} // $self->{pg}->db;
+ my $uid = $opt{uid};
+ my $profile = $opt{profile};
+
+ $db->update(
+ 'users',
+ { profile => JSON->new->encode($profile) },
+ { id => $uid }
+ );
+}
+
+sub get_profile {
+ my ( $self, %opt ) = @_;
+
+ my $db = $opt{db} // $self->{pg}->db;
+ my $uid = $opt{uid};
+
+ return $db->select( 'users', ['profile'], { id => $uid } )
+ ->expand->hash->{profile};
+}
+
sub get_relation {
my ( $self, %opt ) = @_;