Add TenantID filter to TenantFilter for querying by tenant
This commit is contained in:
parent
44ba63410e
commit
a2790436d2
|
|
@ -13,7 +13,7 @@ type Tenant struct {
|
|||
type TenantFilter struct {
|
||||
pagination.BaseFilter
|
||||
Name string `form:"name"` // tambahkan ini
|
||||
|
||||
TenantID string `form:"tenant_id"` // tambahkan ini
|
||||
}
|
||||
|
||||
func (f *TenantFilter) ApplyFilters(query *gorm.DB) *gorm.DB {
|
||||
|
|
@ -21,6 +21,9 @@ func (f *TenantFilter) ApplyFilters(query *gorm.DB) *gorm.DB {
|
|||
if f.Name != "" {
|
||||
query = query.Where("name ILIKE ?", "%"+f.Name+"%")
|
||||
}
|
||||
if f.TenantID != "" {
|
||||
query = query.Where("id = ?", f.TenantID)
|
||||
}
|
||||
return query
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue