Fix country set backend

This commit is contained in:
CHIEFSOFT\ameye
2025-10-07 06:13:56 -04:00
parent 18562c922e
commit d561d942dd
2 changed files with 28 additions and 5 deletions
+11 -4
View File
@@ -43,14 +43,21 @@ class OfficeCountryService(BaseService):
def set_office_country_list(data):
logger.info('ENTER API::get set_office_country_list')
try:
account_result_data =[]
account_result = Country.get_all_countries()
val_type = data.get('val_type', '')
country_uid = data.get('country_uid', '')
code = data.get('code', '')
val = data.get('val', '')
country_result=[]
if val_type == 'STATUS':
country_result = Country.set_country_status(country_uid, code, val)
if val_type == 'SIGNUP':
country_result = Country.set_country_signup(country_uid, code, val)
account_result = {
"set_country_data":[],
"message": "Pending implementation"
"set_country_data":country_result,
"message": "Updated"
}
logger.info('RETURN API::get office account view')
logger.info(account_result)
+17 -1
View File
@@ -29,6 +29,23 @@ class Country(db.Model):
return None
return country_list
@classmethod
def set_country_status(cls, country_uid, code, val):
country_data = cls.query.filter_by(uid=str(country_uid), code=str(code)).first()
if not country_data:
return None
country_data.status = val
return country_data
@classmethod
def set_country_signup(cls, country_uid, code, val):
country_data = cls.query.filter_by(uid=str(country_uid), code=str(code)).first()
if not country_data:
return None
country_data.signup = val
return country_data
def to_dict(self):
return {
"id": self.id,
@@ -40,7 +57,6 @@ class Country(db.Model):
"added": self.added.isoformat() if self.added else None
}
'''
CREATE TABLE country (
id SERIAL,