sort and filter added to tenders web
This commit is contained in:
@@ -1,14 +1,33 @@
|
||||
import 'package:tm_app/core/utils/logger.dart';
|
||||
|
||||
class TendersApi {
|
||||
static const String tenders = '/api/v1/tenders';
|
||||
static String getTenders({
|
||||
required int limit,
|
||||
required int offset,
|
||||
String? query,
|
||||
String? sortBy,
|
||||
String? sortOrder,
|
||||
String? publicationDateFrom,
|
||||
String? publicationDateTo,
|
||||
}) {
|
||||
String url = '$tenders?limit=$limit&offset=$offset';
|
||||
if (query != null && query.isNotEmpty) {
|
||||
url += '&q=${Uri.encodeComponent(query)}';
|
||||
}
|
||||
if (sortBy != null && sortBy.isNotEmpty) {
|
||||
url += '&sort_by=$sortBy';
|
||||
}
|
||||
if (sortOrder != null && sortOrder.isNotEmpty) {
|
||||
url += '&sort_order=$sortOrder';
|
||||
}
|
||||
if (publicationDateFrom != null && publicationDateFrom.isNotEmpty) {
|
||||
url += '&publication_date_from=$publicationDateFrom';
|
||||
}
|
||||
if (publicationDateTo != null && publicationDateTo.isNotEmpty) {
|
||||
url += '&publication_date_to=$publicationDateTo';
|
||||
}
|
||||
AppLogger().logWarning('🔍 Tenders API: $url');
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user