fix(api): fix patching fields

This commit is contained in:
Sam 2022-06-17 16:03:47 +02:00
parent 512e977d0d
commit 59a1a3fb9b

View file

@ -104,9 +104,10 @@ func (db *DB) SetUserFields(ctx context.Context, tx pgx.Tx, userID xid.ID, field
_, err = tx.CopyFrom(ctx, _, err = tx.CopyFrom(ctx,
pgx.Identifier{"user_fields"}, pgx.Identifier{"user_fields"},
[]string{"name", "favourite", "okay", "jokingly", "friends_only", "avoid"}, []string{"user_id", "name", "favourite", "okay", "jokingly", "friends_only", "avoid"},
pgx.CopyFromSlice(len(fields), func(i int) ([]any, error) { pgx.CopyFromSlice(len(fields), func(i int) ([]any, error) {
return []any{ return []any{
userID,
fields[i].Name, fields[i].Name,
fields[i].Favourite, fields[i].Favourite,
fields[i].Okay, fields[i].Okay,