Add Get endpoint for /music
This commit is contained in:
parent
1514a96a2e
commit
f2f5654c0f
17
endpoints/music.get.py
Normal file
17
endpoints/music.get.py
Normal file
@ -0,0 +1,17 @@
|
||||
# Entity: Artist
|
||||
|
||||
from fastapi import APIRouter, Depends, status
|
||||
from sqlalchemy.orm import Session
|
||||
from typing import List
|
||||
from core.database import get_db
|
||||
from core.models.artist import Artist
|
||||
from core.schemas.artist import ArtistSchema
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/music", status_code=200, response_model=List[ArtistSchema])
|
||||
async def get_artists_in_norway(
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
artists = db.query(Artist).filter(Artist.country == "Norway").all()
|
||||
return artists
|
Loading…
x
Reference in New Issue
Block a user