19 lines
559 B
Python
19 lines
559 B
Python
from fastapi import APIRouter, Depends
|
|
from typing import List
|
|
from uuid import UUID
|
|
from sqlalchemy.orm import Session
|
|
from core.database import get_db
|
|
from schemas.shortened_url import ShortenedUrlSchema
|
|
from helpers.shortened_url_helpers import get_user_shortened_urls
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/api/urls", response_model=List[ShortenedUrlSchema])
|
|
async def get_user_urls(
|
|
user_id: UUID,
|
|
skip: int = 0,
|
|
limit: int = 100,
|
|
db: Session = Depends(get_db)
|
|
):
|
|
urls = get_user_shortened_urls(db, user_id, skip, limit)
|
|
return urls |