Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
victorleaoo authored Aug 11, 2024
2 parents f9fb228 + e39981f commit fd2f5d6
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 21 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Merge Repositories

on: [repository_dispatch]

jobs:
sync_with_upstream:
runs-on: ubuntu-latest
environment: actions

steps:
- name: Checkout fork
uses: actions/checkout@v3
with:
repository: victorleaoo/2024.1-UnB-TV-VideoService
ref: develop
token: ${{ secrets.API_GITHUB_TOKEN }}
fetch-depth: 0

- name: Configure Git user
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
- name: Add and fetch upstream
run: |
git remote add upstream https://github.com/fga-eps-mds/2024.1-UnB-TV-VideoService.git
git fetch upstream
- name: Merge upstream changes
run: |
git checkout develop
git merge upstream/develop --no-ff
git push origin develop --force
6 changes: 3 additions & 3 deletions src/controller/savedVideosController.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from fastapi import APIRouter, HTTPException, Depends, Query
from sqlalchemy.orm import Session
from domain import savedVideosSchema
from database import get_db
from repository import savedVideosRepository
from src.domain import savedVideosSchema
from src.database import get_db
from src.repository import savedVideosRepository
from starlette.responses import JSONResponse

WatchLater = APIRouter(
Expand Down
4 changes: 2 additions & 2 deletions src/controller/scheduleController.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from unidecode import unidecode
from starlette.responses import JSONResponse

from utils import enumeration
from constants import errorMessages
from src.utils import enumeration
from src.constants import errorMessages

schedule = APIRouter(
prefix="/schedule"
Expand Down
15 changes: 8 additions & 7 deletions src/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, declarative_base

POSTGRES_USER = os.getenv("POSTGRES_USER")
POSTGRES_PASSWORD = os.getenv("POSTGRES_PASSWORD")
POSTGRES_HOST = os.getenv("POSTGRES_HOST")
POSTGRES_DB = os.getenv("POSTGRES_DB")
POSTGRES_PORT = os.getenv("POSTGRES_PORT", default=5432)

POSTGRES_URI = f'postgresql://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_HOST}:{POSTGRES_PORT}/{POSTGRES_DB}'
# POSTGRES_USER = os.getenv("POSTGRES_USER")
# POSTGRES_PASSWORD = os.getenv("POSTGRES_PASSWORD")
# POSTGRES_HOST = os.getenv("POSTGRES_HOST")
# POSTGRES_DB = os.getenv("POSTGRES_DB")
# POSTGRES_PORT = os.getenv("POSTGRES_PORT", default=5432)

POSTGRES_URI = os.getenv("POSTGRES_URL")
#postgresql://unbtv:z66y7sfFA8uEGf5t7LQc2fP2UUTxzMhe@dpg-cqf64o0gph6c73b7iasg-a/unbtv

engine = create_engine(POSTGRES_URI)

Expand Down
8 changes: 4 additions & 4 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
from fastapi import FastAPI
from dotenv import load_dotenv
from fastapi.middleware.cors import CORSMiddleware
from database import init_db # Adicione a função de inicialização do banco de dados
from src.database import init_db # Adicione a função de inicialização do banco de dados



load_dotenv()

from controller import commentController, scheduleController, savedVideosController, recordController
from controller.savedVideosController import WatchLater

from src.controller import scheduleController, savedVideosController, recordController
from src.controller.savedVideosController import WatchLater

# Desativado os os comentarios nos videos
# from database import SessionLocal, engine
Expand Down Expand Up @@ -49,4 +49,4 @@ async def root():
if (len(sys.argv) == 2):
port = sys.argv[1]

uvicorn.run('main:app', reload=True, port=int(port), host="0.0.0.0")
uvicorn.run('main:app', reload=True, port=int(port), host="0.0.0.0")
3 changes: 1 addition & 2 deletions src/model/recordModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ class Record(Base):
__tablename__ = 'record'
id = Column(String, primary_key=True, index=True, default=lambda: str(uuid.uuid4()))
user_id = Column(String, index=True, nullable=False)
videos = Column(JSON, nullable=False)

videos = Column(JSON, nullable=False)
2 changes: 1 addition & 1 deletion src/model/savedVideosModel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import uuid
from sqlalchemy import Column, String, Boolean
from database import Base
from src.database import Base

class WatchLater(Base):
__tablename__ = 'watch_later'
Expand Down
4 changes: 2 additions & 2 deletions src/repository/savedVideosRepository.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from sqlalchemy.orm import Session

from domain import savedVideosSchema
from model import savedVideosModel
from src.domain import savedVideosSchema
from src.model import savedVideosModel
from fastapi import HTTPException

def create_watch_later(db: Session, watch_later: savedVideosSchema.WatchLaterCreate):
Expand Down
8 changes: 8 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"builds": [
{ "src": "src/main.py", "use": "@vercel/python" }
],
"routes": [
{ "src": "/(.*)", "dest": "src/main.py" }
]
}

0 comments on commit fd2f5d6

Please sign in to comment.