Skip to content

Commit

Permalink
Refactor to import models from neon_data_models package
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Nov 4, 2024
1 parent 6c1a73f commit e004b51
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 249 deletions.
2 changes: 1 addition & 1 deletion neon_users_service/databases/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from abc import ABC, abstractmethod

from neon_users_service.exceptions import UserNotFoundError
from neon_users_service.models import User
from neon_data_models.models.user.database import User


class UserDatabase(ABC):
Expand Down
2 changes: 1 addition & 1 deletion neon_users_service/databases/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from neon_users_service.databases import UserDatabase
from neon_users_service.exceptions import UserNotFoundError, UserExistsError, DatabaseError
from neon_users_service.models import User, AccessRoles
from neon_data_models.models.user.database import User


class SQLiteUserDatabase(UserDatabase):
Expand Down
150 changes: 0 additions & 150 deletions neon_users_service/models.py

This file was deleted.

5 changes: 3 additions & 2 deletions neon_users_service/mq_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from neon_mq_connector.connector import MQConnector
from neon_mq_connector.utils.network_utils import b64_to_dict, dict_to_b64
from neon_users_service.exceptions import UserNotFoundError, AuthenticationError, UserNotMatchedError, UserExistsError
from neon_users_service.models import MQRequest, User
from neon_data_models.models.user.database import User
from neon_data_models.models.api.mq import UserDbRequest

from neon_users_service.service import NeonUsersService

Expand All @@ -20,7 +21,7 @@ def __init__(self, config: Optional[dict], service_name: str = "neon_users_servi
self.service = NeonUsersService(module_config)

def parse_mq_request(self, mq_req: dict) -> dict:
mq_req = MQRequest(**mq_req)
mq_req = UserDbRequest(**mq_req)

# Ensure supplied `user` object is consistent with request params
if mq_req.user and mq_req.username != mq_req.user.username:
Expand Down
3 changes: 2 additions & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pydantic~=2.0
ovos-config~=0.1
ovos-utils~=0.0
ovos-utils~=0.0
neon-data-models
94 changes: 0 additions & 94 deletions tests/test_models.py

This file was deleted.

0 comments on commit e004b51

Please sign in to comment.