17 lines
497 B
Python
17 lines
497 B
Python
# 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 |