-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from infinite-options/rp0905
added endpoints for tenantProfile and searchManager
- Loading branch information
Showing
3 changed files
with
72 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from flask import request | ||
from flask_restful import Resource | ||
from flask_jwt_extended import jwt_required, get_jwt_identity | ||
|
||
from data_pm import connect, uploadImage, s3 | ||
|
||
class SearchManager(Resource): | ||
|
||
# def get(self): | ||
# response = {} | ||
# business_location = request.args.get('business_location') | ||
# business_name = request.args.get('business_name') | ||
|
||
# with connect() as db: | ||
# searchQuery = f""" | ||
# SELECT * | ||
# FROM space.businessProfileInfo | ||
# JOIN JSON_TABLE( | ||
# space.businessProfileInfo.business_locations, | ||
# '$[*]' | ||
# COLUMNS ( | ||
# distance VARCHAR(255) PATH '$.distance', | ||
# location VARCHAR(255) PATH '$.location' | ||
# ) | ||
# ) AS json_data ON json_data.location = '{business_location}' | ||
# WHERE space.businessProfileInfo.business_name = '{business_name}'; | ||
# """ | ||
# # print(searchQuery) | ||
# response = db.execute(searchQuery) | ||
# return response | ||
|
||
def get(self): | ||
response = {} | ||
# filters = ['business_uid', 'business_type', | ||
# 'business_name', 'business_locations'] | ||
where = {} | ||
# for filter in filters: | ||
# filterValue = request.args.get(filter) | ||
# if filterValue is not None: | ||
# where[filter] = filterValue | ||
where['business_type'] = 'MANAGEMENT' | ||
# print(where) | ||
with connect() as db: | ||
response = db.select('b_details', where) | ||
return response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters