Enhance company and company category search forms by adding new sortable fields (email, phone, country, state, language, currency) and updating related API documentation.
This commit is contained in:
@@ -56,6 +56,17 @@ func NewRepository(mongoManager *orm.ConnectionManager, logger logger.Logger) Re
|
||||
}
|
||||
}
|
||||
|
||||
func mapCompanySortField(sortBy string) string {
|
||||
switch sortBy {
|
||||
case "country":
|
||||
return "address.country"
|
||||
case "state":
|
||||
return "address.state"
|
||||
default:
|
||||
return sortBy
|
||||
}
|
||||
}
|
||||
|
||||
// Create creates a new company
|
||||
func (r *companyRepository) Create(ctx context.Context, company *Company) error {
|
||||
// Set created/updated timestamps using Unix timestamps
|
||||
@@ -285,7 +296,7 @@ func (r *companyRepository) Search(ctx context.Context, form *SearchForm, pagina
|
||||
pagination.Limit,
|
||||
pagination.Offset,
|
||||
pagination.Cursor,
|
||||
pagination.SortBy,
|
||||
mapCompanySortField(pagination.SortBy),
|
||||
pagination.SortOrder,
|
||||
filter,
|
||||
orm.ListPaginationOptions{},
|
||||
|
||||
Reference in New Issue
Block a user