예제 #1
0
    def get(self):
        parser = reqparse.RequestParser()
        parser.add_argument('query', type=str, required=True)

        args = parser.parse_args()
        query: str = args.get("query")
        if query:
            contacts = ContactService.get_contacts_from_query(
                query=query, uow=current_app.context)
        else:
            contacts = ContactService.list_contacts(current_app.context)
        return {
            "data": contacts,
            "message": "success",
        }, 200
예제 #2
0
 def get(self, uuid: str):
     return {
         "data": ContactService.get_by_uuid(uuid, current_app.context),
         "message": "success"
     }, 200
예제 #3
0
 def get(self):
     return {
         "data": ContactService.list_contacts(current_app.context),
         "message": "success",
     }, 200
예제 #4
0
def create_contact(command: CreateUser, uow: AbstractUnitOfWork):
    return ContactService.add_contact(data=command.data, uow=uow)
예제 #5
0
def create_contact_from_user(event: events.UserCreatedEvent,
                             uow: AbstractUnitOfWork):
    user: UserEntity = event.data
    ContactService.add_contact_from_user(user=user, uow=uow)