diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-02-01 09:11:19 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-02-01 09:11:19 +0700 |
| commit | 60e57d97be4033e43eca982ba833156e69a9cbf6 (patch) | |
| tree | 41dcb7ce96df6efdf076f17c669a9695b253aa8b /indoteknik_api | |
| parent | cf289c9d54691a451937595e9695d02cf894cbb5 (diff) | |
api category
Diffstat (limited to 'indoteknik_api')
| -rw-r--r-- | indoteknik_api/controllers/api_v1/category.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/indoteknik_api/controllers/api_v1/category.py b/indoteknik_api/controllers/api_v1/category.py index 3a83f6a1..ff1baf6b 100644 --- a/indoteknik_api/controllers/api_v1/category.py +++ b/indoteknik_api/controllers/api_v1/category.py @@ -56,12 +56,24 @@ class Category(controller.Controller): data.append(parent_data) return self.response(data) + @http.route(prefix + 'categories_homepage/ids', auth='public', methods=['GET', 'OPTIONS']) + def get_categories_homepage_count(self, **kw): + if not self.authenticate(): + return self.response(code=401, description='Unauthorized') + query = [('status', '=', 'tayang')] + categories = request.env['website.categories.homepage'].search_read(query, ['id']) + return self.response([x['id'] for x in categories]) + + @http.route(prefix + 'categories_homepage', auth='public', methods=['GET', 'OPTIONS']) def get_categories_homepage(self, **kw): if not self.authenticate(): return self.response(code=401, description='Unauthorized') base_url = request.env['ir.config_parameter'].get_param('web.base.url') query = [('status', '=', 'tayang')] + id = kw.get('id') + if id: + query.append(('id', '=', id)) categories = request.env['website.categories.homepage'].search(query, order='sequence') data = [] for category in categories: |
