summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Model/Traewelling.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-10-04 12:27:20 +0200
committerDaniel Friesel <derf@finalrewind.org>2020-10-04 12:27:20 +0200
commit562dd7ccaef9270070d142e9d6cfe8aa164e072e (patch)
tree770f4a5c9b33b1d67366f0a2ab5f0d3cf36d71fa /lib/Travelynx/Model/Traewelling.pm
parent7ef1fe06b9968be758c1cc32f18987a71a2cb698 (diff)
add toot and tweet settings to traewelling checkin
Diffstat (limited to 'lib/Travelynx/Model/Traewelling.pm')
-rw-r--r--lib/Travelynx/Model/Traewelling.pm18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/Travelynx/Model/Traewelling.pm b/lib/Travelynx/Model/Traewelling.pm
index c9b2181..f320a35 100644
--- a/lib/Travelynx/Model/Traewelling.pm
+++ b/lib/Travelynx/Model/Traewelling.pm
@@ -182,15 +182,21 @@ sub set_latest_push_ts {
sub set_sync {
my ( $self, %opt ) = @_;
- my $uid = $opt{uid};
- my $push_sync = $opt{push_sync};
- my $pull_sync = $opt{pull_sync};
+ my $uid = $opt{uid};
+ my $db = $opt{db} // $self->{pg}->db;
- $self->{pg}->db->update(
+ my $res_h
+ = $db->select( 'traewelling', 'data', { user_id => $uid } )->expand->hash;
+
+ $res_h->{data}{toot} = $opt{toot};
+ $res_h->{data}{tweet} = $opt{tweet};
+
+ $db->update(
'traewelling',
{
- push_sync => $push_sync,
- pull_sync => $pull_sync
+ push_sync => $opt{push_sync},
+ pull_sync => $opt{pull_sync},
+ data => JSON->new->encode( $res_h->{data} ),
},
{ user_id => $uid }
);