fec26089ed
- Added JWT authentication support with configurable secret and expiration. - Introduced optional API key validation for endpoints. - Implemented tracking of publication downloads by researchers, storing records in a new PublicationDownload model. - Updated export endpoints to conditionally register downloads based on user authentication. - Enhanced researcher search response to indicate if publications were downloaded by the current user. - Updated environment configuration to include new JWT settings.
30 lines
940 B
Python
30 lines
940 B
Python
from pydantic import BaseModel
|
|
from uuid import UUID
|
|
from typing import Optional, List, Any
|
|
from datetime import datetime
|
|
|
|
class PublicationSchema(BaseModel):
|
|
id: UUID
|
|
put_code: int | None = None
|
|
title: str | None = None
|
|
subtitle: str | None = None
|
|
journal: str | None = None
|
|
doi: str | None = None
|
|
pub_year: int | None = None
|
|
pub_month: int | None = None
|
|
pub_day: int | None = None
|
|
type: str | None = None
|
|
url: str | None = None
|
|
short_description: str | None = None
|
|
citation_type: str | None = None
|
|
citation_value: str | None = None
|
|
language_code: str | None = None
|
|
country: str | None = None
|
|
external_ids: List[Any] | None = None
|
|
contributors: List[Any] | None = None
|
|
hash_fingerprint: str | None = None
|
|
last_modified: datetime | None = None
|
|
status: str | None = None
|
|
downloaded_by_me: bool | None = None
|
|
model_config = {"from_attributes": True}
|