示例#1
0
    def get(self):
        args = auth_parser.parse_args()
        artist = authentication_header_parser(args['Authorization'])

        artist_albums = (AlbumModel.query.filter_by(
            artist_id=artist['id']).order_by('id').all())
        return artist_albums
示例#2
0
    def get(self, album_id):
        args = auth_parser.parse_args()
        artist = authentication_header_parser(args['Authorization'])

        artist_album = (AlbumModel.query.filter_by(
            id=album_id, artist_id=artist['id']).first())

        if not artist_album:
            return '', http.client.NOT_FOUND

        return artist_album
示例#3
0
    def delete(self, song_id):
        args = auth_parser.parse_args()
        artist = authentication_header_parser(args['Authorization'])

        artist_song = (SongModel.query.filter_by(
            id=song_id, artist_id=artist['id']).first())

        if artist_song:
            db.session.delete(artist_song)
            db.session.commit()

        return '', http.client.NO_CONTENT
示例#4
0
    def delete(self, album_id):
        args = auth_parser.parse_args()
        artist = authentication_header_parser(args['Authorization'])

        artist_album = (AlbumModel.query.filter_by(
            id=album_id, artist_id=artist['id']).first())

        if not artist_album:
            return '', http.client.NOT_FOUND

        db.session.delete(artist_album)
        db.session.commit()

        return '', http.client.NO_CONTENT