rider partner

This commit is contained in:
2026-09-09 15:44:27 +05:30
parent 62a441d798
commit e7577fe0cf
11 changed files with 812 additions and 3 deletions

View File

@@ -16,6 +16,9 @@ type PartnerService interface {
CreateRider(rider models.NewRider) (int, error)
UpdateRider(rider models.NewRider) error
GetRiderRoster(tid, aid, pid int) ([]models.RiderRosterRow, error)
CreatePartner(input models.NewPartner) (int, error)
UpdatePartner(input models.NewPartner) error
GetPartnerLocations(partnerid int) ([]models.PartnerLocation, error)
}
type partnerService struct {
@@ -73,3 +76,19 @@ func (s *partnerService) UpdateRider(rider models.NewRider) error {
func (s *partnerService) GetRiderRoster(tid, aid, pid int) ([]models.RiderRosterRow, error) {
return s.repo.GetRiderRoster(tid, aid, pid)
}
/* ── Partners ─────────────────────────────────────────────────────────────── */
// CreatePartner onboards a delivery partner. Platform-side only — a merchant is
// ASSIGNED a partner, never allowed to invent one.
func (s *partnerService) CreatePartner(input models.NewPartner) (int, error) {
return s.repo.CreatePartner(input)
}
func (s *partnerService) UpdatePartner(input models.NewPartner) error {
return s.repo.UpdatePartner(input)
}
func (s *partnerService) GetPartnerLocations(partnerid int) ([]models.PartnerLocation, error) {
return s.repo.GetPartnerLocations(partnerid)
}

View File

@@ -16,6 +16,7 @@ type TenantService interface {
GetTenantLocations(tid int) ([]models.Tenantlocations, error)
GetTenantSlot() (models.Tenantslot, error)
CreateTenantCustomer(req models.CreateTenantCustomerRequest) (*models.Tenantcustomer, error)
AssignPartner(tenantID, partnerID int) error
GetCustomerTenants(customerID int, categoryID int, tenantFlag int) (*models.CustomerTenantResponse, error)
GetTenantPricing(tid, aid int) (models.Tenantpricing, error)
UpdateLocation(input models.Tenantlocations) error
@@ -259,3 +260,11 @@ func (s *tenantService) UpdateOwnProfile(userID, tenantID int, fields map[string
}
return s.repo.UpdateOwnProfile(userID, tenantID, clean)
}
// AssignPartner records which delivery partner supplies a merchant's riders.
//
// Not part of UpdateTenantProfile: that endpoint is the merchant's own, and
// which partner they sit under is the platform's call. See the repository.
func (s *tenantService) AssignPartner(tenantID, partnerID int) error {
return s.repo.AssignPartner(tenantID, partnerID)
}