refactor: annotations

This commit is contained in:
Deluan
2020-01-31 21:09:23 -05:00
committed by Deluan Quintão
parent de1fea64bc
commit 88e01d05f6
16 changed files with 184 additions and 197 deletions
-9
View File
@@ -30,15 +30,6 @@ func userId(ctx context.Context) string {
return usr.ID
}
func (r sqlRepository) newSelectWithAnnotation(itemType, idField string, options ...model.QueryOptions) SelectBuilder {
return r.newSelect(options...).
LeftJoin("annotation on ("+
"annotation.item_id = "+idField+
" AND annotation.item_type = '"+itemType+"'"+
" AND annotation.user_id = '"+userId(r.ctx)+"')").
Columns("starred", "starred_at", "play_count", "play_date", "rating")
}
func (r sqlRepository) newSelect(options ...model.QueryOptions) SelectBuilder {
sq := Select().From(r.tableName)
sq = r.applyOptions(sq, options...)