Add various deleted flags to entities | Add active to subscriptions | Add DeleteUser && DeleteChannel endpoints [skip-tests]
This commit is contained in:
@@ -19,6 +19,7 @@ type SubscriptionFilter struct {
|
||||
ChannelOwnerUserID2 *[]UserID // Used to filter <ChannelOwnerUserID> again
|
||||
ChannelID *[]ChannelID
|
||||
Confirmed *bool
|
||||
Active *bool
|
||||
SubscriberIsChannelOwner *bool
|
||||
Timestamp *time.Time
|
||||
TimestampAfter *time.Time
|
||||
@@ -33,6 +34,8 @@ func (f SubscriptionFilter) SQL() (string, string, sq.PP, error) {
|
||||
|
||||
params := sq.PP{}
|
||||
|
||||
sqlClauses = append(sqlClauses, "(deleted=0)")
|
||||
|
||||
if f.AnyUserID != nil {
|
||||
sqlClauses = append(sqlClauses, fmt.Sprintf("(subscriber_user_id = :%s OR channel_owner_user_id = :%s)", params.Add(*f.AnyUserID), params.Add(*f.AnyUserID)))
|
||||
}
|
||||
@@ -85,6 +88,14 @@ func (f SubscriptionFilter) SQL() (string, string, sq.PP, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if f.Active != nil {
|
||||
if *f.Active {
|
||||
sqlClauses = append(sqlClauses, "(active=1)")
|
||||
} else {
|
||||
sqlClauses = append(sqlClauses, "(active=0)")
|
||||
}
|
||||
}
|
||||
|
||||
if f.SubscriberIsChannelOwner != nil {
|
||||
if *f.SubscriberIsChannelOwner {
|
||||
sqlClauses = append(sqlClauses, "(subscriber_user_id = channel_owner_user_id)")
|
||||
|
||||
Reference in New Issue
Block a user