Skip to content

Commit

Permalink
post put ownerProfileInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
gthampi committed Aug 31, 2023
1 parent 789ff6d commit 5d407cf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
6 changes: 4 additions & 2 deletions myspace_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from properties import Properties, PropertiesByOwner, PropertyDashboardByOwner
from transactions import AllTransactions, TransactionsByOwner, TransactionsByOwnerByProperty
from cashflow import CashflowByOwner
from profiles import OwnerProfile, TenantProfile
from profiles import OwnerProfile, TenantProfile, OwnerProfileByOwnerUid
from documents import OwnerDocuments, TenantDocuments
from leases import LeaseDetails
from purchases import Bills
Expand Down Expand Up @@ -399,9 +399,11 @@ def get(self, tenant_id):
api.add_resource(Payments, '/makePayment')


api.add_resource(OwnerProfile, '/ownerProfile/<string:owner_id>')
api.add_resource(OwnerProfileByOwnerUid, '/ownerProfile/<string:owner_id>')
api.add_resource(TenantProfile, '/tenantProfile/<string:tenant_id>')

api.add_resource(OwnerProfile, '/ownerProfile') # POST, PUT OwnerProfile

api.add_resource(OwnerDocuments, '/ownerDocuments/<string:owner_id>')
api.add_resource(TenantDocuments, '/tenantDocuments/<string:tenant_id>')

Expand Down
19 changes: 18 additions & 1 deletion profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,25 @@
# BY MONTH X X X
# BY YEAR X X X


class OwnerProfile(Resource):
def post(self):
print('in Owner Profile')
response = {}
payload = request.get_json()
with connect() as db:
response = db.insert('ownerProfileInfo', payload)
return response

def put(self):
print('in Owner Profile')
response = {}
payload = request.get_json()
key = {'owner_uid': payload.pop('owner_uid')}
with connect() as db:
response = db.update('ownerProfileInfo', key, payload)
return response

class OwnerProfileByOwnerUid(Resource):
# decorators = [jwt_required()]

def get(self, owner_id):
Expand Down

0 comments on commit 5d407cf

Please sign in to comment.