def map_domain_to_dbal(self, domain_entity): return DBALArtist( id=decode_id.dbal(domain_entity.entity_id), name=domain_entity.name, artist_type=domain_entity.type_, genre_id=decode_id.dbal(domain_entity.genre_id), )
def map_domain_to_dbal(self, domain_entity): return DBALAlbum( id=decode_id.dbal(domain_entity.entity_id), name=domain_entity.name, artist_id=decode_id.dbal(domain_entity.artist_id), genre_id=decode_id.dbal(domain_entity.genre_id), )
def map_domain_to_dbal(self, domain_entity): return DBALMusicRating( id=decode_id.dbal(domain_entity.entity_id), artist_id=decode_id.dbal(domain_entity.artist_id), album_id=decode_id.dbal(domain_entity.album_id), track_id=decode_id.dbal(domain_entity.track_id), created_at=domain_entity.created_at, updated_at=domain_entity.updated_at, rating=domain_entity.rating, )
def _get_dbal_entity(self, entity_id): dbal_id = decode_id.dbal(entity_id) try: return self.session.query(self.model).filter_by(id=dbal_id).one() except NoResultFound: raise NotFound( f'Entity: {self.model.__tablename__} could not be found')
def map_domain_to_dbal(self, domain_entity): return DBALGenre( id=decode_id.dbal(domain_entity.entity_id), name=domain_entity.name, )