feat(backend): use jsonb instead of composite type arrays

This commit is contained in:
Sam 2023-03-12 01:31:10 +01:00
parent f358a56053
commit b8a7e7443d
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
14 changed files with 161 additions and 1467 deletions

View file

@ -97,13 +97,13 @@ func (db *DB) InvalidateToken(ctx context.Context, userID xid.ID, tokenID xid.ID
return t, nil
}
func (db *DB) InvalidateAllTokens(ctx context.Context, q querier, userID xid.ID) error {
func (db *DB) InvalidateAllTokens(ctx context.Context, tx pgx.Tx, userID xid.ID) error {
sql, args, err := sq.Update("tokens").Where("user_id = ?", userID).Set("invalidated", true).ToSql()
if err != nil {
return errors.Wrap(err, "building sql")
}
_, err = q.Exec(ctx, sql, args...)
_, err = tx.Exec(ctx, sql, args...)
if err != nil {
return errors.Wrap(err, "executing query")
}