fix: require reactions to be unique for owner, asset
add: cut off really long text in posts
This commit is contained in:
parent
a1c6beb664
commit
d7a37809ba
9 changed files with 27 additions and 37 deletions
|
@ -653,6 +653,7 @@ impl DataManager {
|
|||
auto_method!(get_user_by_stripe_id(&str)@get_user_from_row -> "SELECT * FROM users WHERE stripe_id = $1" --name="user" --returns=User);
|
||||
auto_method!(update_user_stripe_id(&str)@get_user_by_id -> "UPDATE users SET stripe_id = $1 WHERE id = $2" --cache-key-tmpl=cache_clear_user);
|
||||
|
||||
auto_method!(update_user_notification_count(i32)@get_user_by_id -> "UPDATE users SET notification_count = $1 WHERE id = $2" --cache-key-tmpl=cache_clear_user);
|
||||
auto_method!(incr_user_notifications()@get_user_by_id -> "UPDATE users SET notification_count = notification_count + 1 WHERE id = $1" --cache-key-tmpl=cache_clear_user --incr);
|
||||
auto_method!(decr_user_notifications()@get_user_by_id -> "UPDATE users SET notification_count = notification_count - 1 WHERE id = $1" --cache-key-tmpl=cache_clear_user --decr=notification_count);
|
||||
|
||||
|
|
|
@ -4,5 +4,6 @@ CREATE TABLE IF NOT EXISTS reactions (
|
|||
owner BIGINT NOT NULL,
|
||||
asset BIGINT NOT NULL,
|
||||
asset_type TEXT NOT NULL,
|
||||
is_like INT NOT NULL
|
||||
is_like INT NOT NULL,
|
||||
UNIQUE (owner, asset)
|
||||
)
|
||||
|
|
|
@ -187,6 +187,8 @@ impl DataManager {
|
|||
self.delete_notification(notification.id, user).await?
|
||||
}
|
||||
|
||||
self.update_user_notification_count(user.id, 0).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue