Versión 3 Backend - Endpoints finales corregidos

This commit is contained in:
Mireya Cueto Garrido
2026-04-27 13:39:32 +02:00
parent a286c2e3ae
commit 96f01c0126
4343 changed files with 1046097 additions and 465 deletions
@@ -0,0 +1,25 @@
from sqlalchemy.orm import Session
from app.db.models import Researcher
from sqlalchemy.sql import func
class ResearcherRepository:
@staticmethod
def get_by_orcid(db: Session, orcid_id: str):
return db.query(Researcher).filter(Researcher.orcid_id == orcid_id).first()
@staticmethod
def create(db: Session, orcid_id: str, name: str = None):
researcher = Researcher(orcid_id=orcid_id, name=name)
db.add(researcher)
db.commit()
db.refresh(researcher)
return researcher
@staticmethod
def update_last_sync(db: Session, researcher: Researcher):
researcher.last_sync_at = func.now()
db.commit()
db.refresh(researcher)
return researcher