feat: add profile sync

This commit is contained in:
Philipp
2026-06-10 16:32:46 +02:00
parent 9947286b1e
commit 000c08dae7
11 changed files with 251 additions and 8 deletions
+25
View File
@@ -0,0 +1,25 @@
package profile
import (
"context"
"database/sql"
)
type Repository struct {
db *sql.DB
}
func NewRepository(db *sql.DB) Repository {
return Repository{db: db}
}
func (r Repository) Ensure(ctx context.Context, id string, email string) error {
_, err := r.db.ExecContext(ctx, `
insert into public.profiles (id, email)
values ($1, $2)
on conflict (id) do update
set email = excluded.email
where public.profiles.email is distinct from excluded.email
`, id, email)
return err
}