@@ -94,10 +94,32 @@ All list endpoints support:
9494- ` limit ` - Items per page (default: 10)
9595- ` name ` - Search by name (partial match)
9696- ` code ` - Filter by code (returns entity directly)
97+ - ` sortBy ` - Field to sort by (optional, defaults to ` code ` )
98+ - ` sortDirection ` - Sort direction: ` ASC ` or ` DESC ` (default: ` ASC ` )
9799- ` provinceCode ` - Filter by parent province
98100- ` regencyCode ` - Filter by parent regency
99101- ` districtCode ` - Filter by parent district
100102
103+ #### Sorting Options
104+
105+ Each endpoint supports different sort fields:
106+ - ** Provinces** : ` code ` , ` province `
107+ - ** Regencies** : ` code ` , ` regency ` , ` provinceCode ` , ` type `
108+ - ** Districts** : ` code ` , ` district ` , ` regencyCode `
109+ - ** Villages** : ` code ` , ` village ` , ` districtCode ` , ` postalCode `
110+
111+ ** Examples:**
112+ ``` bash
113+ # Sort provinces by name in ascending order
114+ GET /province? sortBy=province& sortDirection=ASC
115+
116+ # Sort regencies by name in descending order
117+ GET /regency? provinceCode=11& sortBy=regency& sortDirection=DESC
118+
119+ # Default behavior (no sorting params = sort by code ASC)
120+ GET /province
121+ ```
122+
101123## 🗄️ Database Setup (For Self-Hosting)
102124
103125### Step 1: Create Supabase Project
@@ -188,7 +210,7 @@ In Vercel dashboard (or `.env` file for local development), add:
188210DATABASE_URL=postgresql://postgres.[PROJECT-REF]:[PASSWORD]@aws-0-[REGION].pooler.supabase.com:6543/postgres?pgbouncer=true
189211NODE_ENV=production
190212APP_ENV=production
191- DATABASE_SCHEMA=aloe # Optional: only if using a custom schema
213+ DATABASE_SCHEMA=konoland-schema # Optional: only if using a custom schema
192214```
193215
194216## 🛠️ Local Development
0 commit comments