partner list

This commit is contained in:
2026-09-17 11:04:37 +05:30
parent 2f1501883b
commit 692c10e553
2 changed files with 16 additions and 11 deletions

View File

@@ -299,8 +299,11 @@ type NewPartner struct {
because the rider app reads it. The same region is also written to because the rider app reads it. The same region is also written to
`partnerlocations`, which is the table that may hold SEVERAL — a partner `partnerlocations`, which is the table that may hold SEVERAL — a partner
routinely serves more than one city, and that is why the link table routinely serves more than one city, and that is why the link table
exists. Nothing populates more than one today: `regionsOf` returns this exists, and partners with two are live — partner 44 covers regions 1 and
single field and the console's form offers one district, never a set. 2. Nothing on THIS path creates one: `regionsOf` returns this single
field and the console's form offers one district, never a set. So a
multi-region partner can be read and must be handled, but cannot yet be
made here.
`GetPartners` reads the link table rather than this field, for two `GetPartners` reads the link table rather than this field, for two
reasons. It is the column allowed to grow, so a partner who covers a reasons. It is the column allowed to grow, so a partner who covers a

View File

@@ -109,16 +109,18 @@ func (r *partnerRepository) GetPartners(aid, pid, uid int) ([]models.Partnerinfo
// //
// `partnerinfo.applocationid` is the HOME region — CreatePartner writes // `partnerinfo.applocationid` is the HOME region — CreatePartner writes
// `regions[0]` there — while partnerlocations holds every region covered. // `regions[0]` there — while partnerlocations holds every region covered.
// Today those are always the same one region, because `regionsOf` returns a // Those are not the same thing, and not only in theory: partner 44,
// single district and the console's form offers one ("never a set"). So // Xpress-Cbe-Main, has a home region of 1 and link rows for 1 AND 2, so
// this is not a behaviour change yet; it is the filter being applied to the // filtering on the partner row hid them from every Madurai query. That is
// column that is allowed to grow. The moment a partner covers two cities, // the case the link table exists for.
// filtering on the home region would hide them from the second, and the
// link table is the whole reason that table exists.
// //
// DISTINCT for that same future: a partner covering three regions has three // DISTINCT because such a partner has one row per region in the join and is
// rows in the join and is still one partner. Only partnerinfo columns are // still one partner. Only partnerinfo columns are selected, so there is
// selected, so there is nothing per-region for it to fail to collapse. // nothing per-region for it to fail to collapse.
//
// A caller fanning out over regions and concatenating the answers still has
// to dedupe — the same partner is legitimately in two of them. The console's
// `useAllPartners` does; it listed Xpress-Cbe-Main twice until it did.
const columns = `select distinct p.partnerid,p.applocationid,p.partnertypeid,p.partnername, const columns = `select distinct p.partnerid,p.applocationid,p.partnertypeid,p.partnername,
p.primarycontact,p.primaryemail,p.contactno,p.address,p.suburb,p.state,p.city,p.partnerimage p.primarycontact,p.primaryemail,p.contactno,p.address,p.suburb,p.state,p.city,p.partnerimage
from partnerinfo p from partnerinfo p