Follow accept works and messags are pushed as expected
Some checks failed
/ docker (push) Failing after 2m50s
Some checks failed
/ docker (push) Failing after 2m50s
This commit is contained in:
parent
9a3a330b1d
commit
ff6a730e58
10 changed files with 482 additions and 19 deletions
|
@ -7,6 +7,7 @@ package dbgen
|
|||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"strings"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
||||
"gorm.io/gorm"
|
||||
|
@ -587,6 +588,30 @@ type IUserToUserRelationDo interface {
|
|||
Returning(value interface{}, columns ...string) IUserToUserRelationDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
|
||||
GetFollowersForId(id string) (result []string, err error)
|
||||
}
|
||||
|
||||
// SELECT u.inbox_link
|
||||
// FROM user_to_user_relations r
|
||||
// LEFT JOIN user_remote_links u
|
||||
// ON r.user_id = u.user_id
|
||||
// WHERE
|
||||
//
|
||||
// r.target_user_id = @id AND
|
||||
// r.relation = 'follow'
|
||||
func (u userToUserRelationDo) GetFollowersForId(id string) (result []string, err error) {
|
||||
var params []interface{}
|
||||
|
||||
var generateSQL strings.Builder
|
||||
params = append(params, id)
|
||||
generateSQL.WriteString("SELECT u.inbox_link FROM user_to_user_relations r LEFT JOIN user_remote_links u ON r.user_id = u.user_id WHERE r.target_user_id = ? AND r.relation = 'follow' ")
|
||||
|
||||
var executeSQL *gorm.DB
|
||||
executeSQL = u.UnderlyingDB().Raw(generateSQL.String(), params...).Find(&result) // ignore_security_alert
|
||||
err = executeSQL.Error
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (u userToUserRelationDo) Debug() IUserToUserRelationDo {
|
||||
|
|
|
@ -11,3 +11,14 @@ type UserToUserRelation struct {
|
|||
TargetUserId string
|
||||
Relation string // `gorm:"type:relation_type"`
|
||||
}
|
||||
|
||||
type IUserToUserRelation interface {
|
||||
// SELECT u.inbox_link
|
||||
// FROM user_to_user_relations r
|
||||
// LEFT JOIN user_remote_links u
|
||||
// ON r.user_id = u.user_id
|
||||
// WHERE
|
||||
// r.target_user_id = @id AND
|
||||
// r.relation = 'follow'
|
||||
GetFollowersForId(id string) ([]string, error)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue