Add province-scoped branches for loan paid letters and harden loans.user_id.

Expose GET /loan-paid-off-letters/branches?province_id= for form pickers, require loans.user_id, and proxy the Vite frontend under /online/.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-12 19:12:49 +05:00
parent 1987d4f596
commit 5f6ddc5217
14 changed files with 172 additions and 343 deletions

View File

@@ -43,13 +43,13 @@ func (r *repository) List(ctx context.Context, filter province.ListFilter) (prov
}
func (r *repository) ListRegions(ctx context.Context, activeOnly bool) (province.ListRegionsDTO, error) {
query := `SELECT DISTINCT region FROM provinces`
inner := `SELECT DISTINCT region::jsonb AS region FROM provinces`
var args []interface{}
if activeOnly {
query += ` WHERE active = $1`
inner += ` WHERE active = $1`
args = append(args, true)
}
query += ` ORDER BY region->>'tm', region->>'en', region->>'ru'`
query := `SELECT region FROM (` + inner + `) AS distinct_regions ORDER BY region->>'tm', region->>'en', region->>'ru'`
rows, err := r.client.Query(ctx, query, args...)
if err != nil {