Change endpoints/common to use a data interface
This commit is contained in:
parent
aecec02b6c
commit
f976ffbdc7
4 changed files with 67 additions and 12 deletions
21
endpoints/common_models_pre_oci.py
Normal file
21
endpoints/common_models_pre_oci.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
from data import model
|
||||
from endpoints.common_models_interface import User, EndpointsCommonDataInterface
|
||||
|
||||
|
||||
class EndpointsCommonDataPreOCIModel(EndpointsCommonDataInterface):
|
||||
def get_user(self, user_uuid):
|
||||
user = model.user.get_user_by_uuid(user_uuid)
|
||||
if user is None:
|
||||
return None
|
||||
|
||||
return User(uuid=user.uuid, username=user.username, email=user.email,
|
||||
given_name=user.given_name, family_name=user.family_name, company=user.company)
|
||||
|
||||
def get_namespace_uuid(self, namespace_name):
|
||||
user = model.user.get_namespace_user(namespace_name)
|
||||
if user is None:
|
||||
return None
|
||||
|
||||
return user.uuid
|
||||
|
||||
pre_oci_model = EndpointsCommonDataPreOCIModel()
|
Reference in a new issue