Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
045bc4ff6c | ||
|
|
e48262cfaa | ||
|
|
b0b59ee3d3 | ||
|
|
7667439658 | ||
|
|
8f93870cec | ||
|
|
26d8caf05c | ||
|
|
48c5c376bc | ||
|
|
4aca320d8d | ||
|
|
a3783aecd3 |
+24
-2
@@ -12,9 +12,31 @@ task test(type: Exec) {
|
||||
ignoreExitValue false
|
||||
}
|
||||
|
||||
task exportOpenApiSpec(type: Exec) {
|
||||
dependsOn createImage
|
||||
def openApiDir = layout.buildDirectory.dir('openapi').get().asFile
|
||||
def openApiFile = new File(openApiDir, 'inse-service.openapi.json')
|
||||
inputs.dir file('src/main/inse')
|
||||
outputs.file openApiFile
|
||||
doFirst {
|
||||
openApiDir.mkdirs()
|
||||
}
|
||||
commandLine 'docker', 'run', '--rm',
|
||||
'--platform', "${targetPlatform}",
|
||||
'-w', '/home',
|
||||
'-v', "${projectDir}/src/main:/home",
|
||||
'-v', "${openApiDir}:/mnt/openapi",
|
||||
'-e', "DOCKER_DEFAULT_PLATFORM='${targetPlatform}'",
|
||||
'--name', "${imageName}-service-openapi",
|
||||
'--entrypoint', 'python',
|
||||
"${imagePrefix}-service:${imageVersion}",
|
||||
'-c',
|
||||
'import json; from inse.service import app; open("/mnt/openapi/inse-service.openapi.json", "w").write(json.dumps(app.openapi(), indent=2))'
|
||||
}
|
||||
|
||||
task runServeContainer(type: Exec) {
|
||||
dependsOn createImage
|
||||
commandLine 'docker', 'run', '--rm', '-v', "${projectDir}/src/main:/home", '-v', "${projectDir}/src/data:/data", '-p', '8000:8000', '-e', "DOCKER_DEFAULT_PLATFORM='${targetPlatform}'", '-e', "INSE_AUTH_STANDALONE=true", '--name', "${imageName}-service-serve", '--detach', "${imagePrefix}-service:${imageVersion}", 'run', '--reload', '--reload-dir', './inse'
|
||||
commandLine 'docker', 'run', '--rm', '-v', "${projectDir}/src/main:/home", '-v', "${projectDir}/src/data:/data", '-p', '8000:8000', '-e', "DOCKER_DEFAULT_PLATFORM='${targetPlatform}'", '-e', "INSE_AUTH_STANDALONE=true", '-e', 'INSE_OPENALEX_WORKS_API_KEY', '--name', "${imageName}-service-serve", '--detach', "${imagePrefix}-service:${imageVersion}", 'run', '--reload', '--reload-dir', './inse'
|
||||
}
|
||||
|
||||
task stopServeContainer(type: Exec) {
|
||||
@@ -47,5 +69,5 @@ task serve(type: Task) {
|
||||
}
|
||||
|
||||
build {
|
||||
dependsOn createImage, test
|
||||
dependsOn createImage, exportOpenApiSpec, test
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,11 +19,16 @@ class Settings(BaseSettings):
|
||||
auth_disabled: bool = False
|
||||
auth_standalone: bool = True
|
||||
auth_secret: str = 'change-me-to-a-secure-secret-key'
|
||||
# OpenAlex works search config
|
||||
openalex_works_search_base_url: str = 'https://project.nes.uni-due.de/elastic'
|
||||
openalex_works_search_index: str = 'openalex-works'
|
||||
openalex_works_api_key: str = 'am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ=='
|
||||
openalex_works_search_timeout_seconds: float = 30.0
|
||||
llm_api_url: str = 'https://project.nes.uni-due.de/llm2/api/generate'
|
||||
llm_api_token: str = 'c2d5e7ccf7a4760dd3d19bed2caed9d85ff7437400e0ea82a6d6f912ebc2f212'
|
||||
llm_model: str = 'gemma4:e4b'
|
||||
elasticsearch_url: str = 'https://project.nes.uni-due.de/elastic/openalex-authors/_search'
|
||||
elasticsearch_url: str = 'https://project.nes.uni-due.de/elastic/'
|
||||
elasticsearch_api_key: str = 'am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ=='
|
||||
|
||||
settings = Settings()
|
||||
logger.info(f"Database URL: {settings.database_url}.")
|
||||
logger.info(f"Database URL: {settings.database_url}.")
|
||||
|
||||
@@ -22,6 +22,7 @@ from . import model
|
||||
from . import config
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
topic_cache_filename: str = "topic_hierarchy_cache.json"
|
||||
|
||||
S = TypeVar('S', bound=schema.Base)
|
||||
M = TypeVar('M', bound=model.BaseModel)
|
||||
@@ -59,6 +60,144 @@ def insert_element(db: Session, value: S) -> S:
|
||||
db.refresh(value)
|
||||
return value
|
||||
|
||||
def _load_topic_cache() -> dict:
|
||||
"""Loads the topic hierarchy cache from a JSON file. """
|
||||
try:
|
||||
cache_path = "/data/" + topic_cache_filename
|
||||
with open(cache_path, "r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
except Exception as exc:
|
||||
logger.warning("Failed to load topic hierarchy cache: %s", exc)
|
||||
return {}
|
||||
|
||||
def build_topic_cache(page_size: int = 200,
|
||||
save_json: bool = True) -> dict:
|
||||
"""
|
||||
Fetch topics from the hosted OpenAlex topics index and build a lookup cache (scheduled task).
|
||||
|
||||
Arguments:
|
||||
page_size (int): Number of topics to fetch per request (default: 200)
|
||||
save_json (bool): Whether to save the cache as a JSON file (default: True)
|
||||
|
||||
Returns:
|
||||
taxonomy_cache (dict): The topic hierarchy dictionary.
|
||||
"""
|
||||
output_filename: str = "topic_hierarchy_cache.json"
|
||||
headers = {
|
||||
"Authorization": f"ApiKey {config.settings.elasticsearch_api_key}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
taxonomy_cache = {}
|
||||
offset = 0
|
||||
|
||||
with httpx.Client(timeout=30.0) as client:
|
||||
while True:
|
||||
payload = {
|
||||
"query": {"match_all": {}},
|
||||
"from": offset,
|
||||
"size": page_size
|
||||
}
|
||||
response = client.post(config.settings.elasticsearch_url + '/openalex-topics/_search', json=payload, headers=headers)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
|
||||
hits = data.get("hits", {}).get("hits", [])
|
||||
if not hits:
|
||||
break
|
||||
|
||||
for hit in hits:
|
||||
source = hit.get("_source", {})
|
||||
topic_name = source.get("display_name") or source.get("name")
|
||||
if not topic_name:
|
||||
continue
|
||||
|
||||
taxonomy_cache[topic_name] = {
|
||||
"topic_id": source.get("id") or hit.get("_id", ""),
|
||||
"subfield": source.get("subfield", {}).get("display_name", ""),
|
||||
"field": source.get("field", {}).get("display_name", ""),
|
||||
"domain": source.get("domain", {}).get("display_name", "")
|
||||
}
|
||||
|
||||
offset += len(hits)
|
||||
logger.info("Processed %s topics total", len(taxonomy_cache))
|
||||
|
||||
if save_json:
|
||||
data_json = json.dumps(taxonomy_cache, indent=2, ensure_ascii=True)
|
||||
try:
|
||||
output_path = "/data/" + output_filename
|
||||
with open(output_path, "w", encoding="utf-8") as f:
|
||||
f.write(data_json)
|
||||
logger.info("Topic hierarchy cache written to %s", output_path)
|
||||
except Exception as exc:
|
||||
logger.warning("Failed to write topic hierarchy cache: %s", exc)
|
||||
|
||||
return taxonomy_cache
|
||||
|
||||
def get_topics_from_cache(topic_names: List[str]) -> List[model.Topic]:
|
||||
"""
|
||||
Given a list of topic names, retrieves their hierarchy information from the cache and returns a list of Topic models.
|
||||
Arguments:
|
||||
topic_names (List[str]): A list of topic names to retrieve.
|
||||
Returns:
|
||||
List[model.Topic]: A list of Topic models.
|
||||
"""
|
||||
cache = _load_topic_cache()
|
||||
topics = []
|
||||
for name in topic_names:
|
||||
data = cache.get(name)
|
||||
if not data:
|
||||
continue
|
||||
topics.append(model.Topic(
|
||||
id=data.get("topic_id", ""),
|
||||
name=name,
|
||||
subfield=data.get("subfield", ""),
|
||||
field=data.get("field", ""),
|
||||
domain=data.get("domain", "")
|
||||
))
|
||||
return topics
|
||||
|
||||
def count_topic_hierarchy(topic_names: List[str]) -> dict:
|
||||
"""
|
||||
Given a list of topic names, counts the occurrences of each topic and their hierarchy levels (subfield, field, domain) using the cache.
|
||||
Arguments:
|
||||
topic_names (List[str]): A list of topic names to count.
|
||||
Returns:
|
||||
dict: A dictionary containing the counts of each hierarchy level.
|
||||
"""
|
||||
cache = _load_topic_cache()
|
||||
counts = {
|
||||
"topics": {},
|
||||
"subfields": {},
|
||||
"fields": {},
|
||||
"domains": {}
|
||||
}
|
||||
|
||||
for name in topic_names:
|
||||
data = cache.get(name)
|
||||
if not data:
|
||||
continue
|
||||
|
||||
counts["topics"][name] = counts["topics"].get(name, 0) + 1
|
||||
|
||||
subfield = data.get("subfield", "")
|
||||
if subfield:
|
||||
counts["subfields"][subfield] = counts["subfields"].get(subfield, 0) + 1
|
||||
|
||||
field = data.get("field", "")
|
||||
if field:
|
||||
counts["fields"][field] = counts["fields"].get(field, 0) + 1
|
||||
|
||||
domain = data.get("domain", "")
|
||||
if domain:
|
||||
counts["domains"][domain] = counts["domains"].get(domain, 0) + 1
|
||||
|
||||
return counts
|
||||
|
||||
|
||||
|
||||
### persons
|
||||
|
||||
def search_persons(author_id: Optional[str] = None, query: Optional[str] = None) -> model.PersonSearchResult:
|
||||
headers = {
|
||||
"Authorization": f"ApiKey {config.settings.elasticsearch_api_key}",
|
||||
@@ -84,7 +223,7 @@ def search_persons(author_id: Optional[str] = None, query: Optional[str] = None)
|
||||
}
|
||||
|
||||
with httpx.Client() as client:
|
||||
response = client.post(config.settings.elasticsearch_url, json=payload, headers=headers)
|
||||
response = client.post(config.settings.elasticsearch_url + '/openalex-authors/_search', json=payload, headers=headers)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
|
||||
@@ -141,3 +280,5 @@ def generate_person_bio(author_id: str) -> str:
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
return data.get("response", "")
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,13 @@ class Page(BaseModel, Generic[T]):
|
||||
class ItemPage(Page[Item]):
|
||||
pass
|
||||
|
||||
class Topic(BaseModel):
|
||||
id: str = Field(description="The openalex topic id.")
|
||||
name: str = Field(description="The topic name.")
|
||||
subfield: str = Field(description="The subfield of the topic.")
|
||||
field: str = Field(description="The field of the topic.")
|
||||
domain: str = Field(description="The domain of the topic.")
|
||||
|
||||
class PersonBio(BaseModel):
|
||||
bio: str = Field(description="The generated biography.")
|
||||
|
||||
@@ -53,3 +60,5 @@ class Person(BaseModel):
|
||||
|
||||
class PersonSearchResult(BaseModel):
|
||||
persons: List[Person] = Field(default=[], description="List of found persons.")
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
service.
|
||||
"""
|
||||
import logging
|
||||
from typing import Annotated
|
||||
from typing import Annotated, List
|
||||
from fastapi import FastAPI
|
||||
from fastapi import Depends
|
||||
from fastapi import Path
|
||||
@@ -22,6 +22,7 @@ from . import schema
|
||||
from . import database
|
||||
from . import security
|
||||
from . import util
|
||||
from .works import service as works_service
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -32,6 +33,7 @@ app = FastAPI(redoc_url=None,
|
||||
title='My App Service',
|
||||
summary='My App Service API',
|
||||
version='1.0.0')
|
||||
app.include_router(works_service.router)
|
||||
|
||||
@app.get("/", include_in_schema=False)
|
||||
async def show_api():
|
||||
@@ -112,6 +114,43 @@ def delete_item(id: Annotated[int, Path(description='The item id.', ge=0)],
|
||||
return Response(status_code=HTTP_200_OK)
|
||||
finally:
|
||||
db.commit()
|
||||
### topics
|
||||
# hierarchy cache (temporaray => should be called by a scheduled job, with new openalex data indexing)
|
||||
@app.get('/topics/cache',
|
||||
operation_id='buildTopicCache',
|
||||
response_model=dict,
|
||||
summary='Builds the topic hierarchy cache.',
|
||||
tags=[ 'Topics' ])
|
||||
def build_topic_cache(page_size: Annotated[int, Query(description='Page size for each search page.', ge=1, le=1000)] = 200,
|
||||
save_json: Annotated[bool, Query(description='Persist cache JSON to data folder.')] = True):
|
||||
return logic.build_topic_cache(page_size=page_size, save_json=save_json)
|
||||
|
||||
@app.get('/topics/count',
|
||||
operation_id='countTopicHierarchy',
|
||||
response_model=dict,
|
||||
summary='Counts topic hierarchy occurrences from cache.',
|
||||
tags=['Topics'])
|
||||
def count_topic_hierarchy(
|
||||
topic_names: Annotated[
|
||||
List[str],
|
||||
Query(
|
||||
alias='topic',
|
||||
description='Topic names (repeat parameter).',
|
||||
example=[
|
||||
"Big Data and Business Intelligence",
|
||||
"Big Data and Business Intelligence",
|
||||
"Topic Modeling",
|
||||
"Entrepreneurship Studies and Influences",
|
||||
"Complex Network Analysis Techniques",
|
||||
"Semantic Web and Ontologies"
|
||||
]
|
||||
)
|
||||
]
|
||||
):
|
||||
return logic.count_topic_hierarchy(topic_names)
|
||||
|
||||
|
||||
### persons
|
||||
|
||||
@app.get('/persons/search',
|
||||
operation_id='searchPersons',
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Works domain package.
|
||||
"""
|
||||
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Business logic for publication works.
|
||||
"""
|
||||
import logging
|
||||
|
||||
import httpx
|
||||
from fastapi import HTTPException
|
||||
from pydantic import ValidationError
|
||||
from starlette.status import HTTP_502_BAD_GATEWAY
|
||||
from starlette.status import HTTP_503_SERVICE_UNAVAILABLE
|
||||
|
||||
from . import model
|
||||
from .search_client import MissingApiKeyError
|
||||
from .search_client import OpenAlexWorksSearchClient
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def get_author_works(
|
||||
author_id: str,
|
||||
page: int,
|
||||
size: int,
|
||||
client: OpenAlexWorksSearchClient | None = None,
|
||||
) -> model.WorkPage:
|
||||
search_client = client or OpenAlexWorksSearchClient()
|
||||
try:
|
||||
data = await search_client.search_author_works(author_id, page, size)
|
||||
except MissingApiKeyError as exc:
|
||||
logger.error("OpenAlex works Elasticsearch API key is not configured.")
|
||||
raise HTTPException(
|
||||
status_code=HTTP_503_SERVICE_UNAVAILABLE,
|
||||
detail="OpenAlex works search is not configured.",
|
||||
) from exc
|
||||
except httpx.HTTPError as exc:
|
||||
logger.exception("OpenAlex works search request failed.")
|
||||
raise HTTPException(
|
||||
status_code=HTTP_502_BAD_GATEWAY,
|
||||
detail="OpenAlex works search request failed.",
|
||||
) from exc
|
||||
|
||||
hits = data.get("hits", {})
|
||||
total = hits.get("total", 0)
|
||||
if isinstance(total, dict):
|
||||
total = total.get("value", 0)
|
||||
|
||||
try:
|
||||
elements = [
|
||||
model.WorkSummary.model_validate(_to_work_summary(hit.get("_source", {})))
|
||||
for hit in hits.get("hits", [])
|
||||
]
|
||||
except ValidationError as exc:
|
||||
logger.exception("OpenAlex works search response could not be parsed.")
|
||||
raise HTTPException(
|
||||
status_code=HTTP_502_BAD_GATEWAY,
|
||||
detail="OpenAlex works search response could not be parsed.",
|
||||
) from exc
|
||||
|
||||
return model.WorkPage(elements=elements, page=page, size=size, total=total)
|
||||
|
||||
|
||||
def _to_work_summary(source: dict) -> dict:
|
||||
return {
|
||||
"doi": source.get("doi"),
|
||||
"title": source.get("title") or source.get("display_name"),
|
||||
"type": source.get("type"),
|
||||
"language": source.get("language"),
|
||||
"publication_year": source.get("publication_year"),
|
||||
"cited_by_count": source.get("cited_by_count") or 0,
|
||||
"topics": [
|
||||
topic["display_name"]
|
||||
for topic in source.get("topics") or []
|
||||
if topic.get("display_name")
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Pydantic models for publication works.
|
||||
"""
|
||||
from typing import List
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import ConfigDict
|
||||
from pydantic import Field
|
||||
|
||||
|
||||
class OpenAlexModel(BaseModel):
|
||||
model_config = ConfigDict(extra="allow")
|
||||
|
||||
|
||||
class Source(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The source id.")
|
||||
display_name: Optional[str] = Field(default=None, description="The source display name.")
|
||||
issn_l: Optional[str] = Field(default=None, description="The linking ISSN.")
|
||||
issn: Optional[List[str]] = Field(default=None, description="The ISSNs of the source.")
|
||||
is_oa: Optional[bool] = Field(default=None, description="Whether the source is open access.")
|
||||
is_in_doaj: Optional[bool] = Field(default=None, description="Whether the source is in DOAJ.")
|
||||
is_core: Optional[bool] = Field(default=None, description="Whether the source is a core source.")
|
||||
host_organization: Optional[str] = Field(default=None, description="The host organization id.")
|
||||
host_organization_name: Optional[str] = Field(default=None, description="The host organization name.")
|
||||
host_organization_lineage: Optional[List[str]] = Field(default=None, description="The host organization lineage.")
|
||||
type: Optional[str] = Field(default=None, description="The source type.")
|
||||
|
||||
|
||||
class Location(OpenAlexModel):
|
||||
is_oa: Optional[bool] = Field(default=None, description="Whether this location is open access.")
|
||||
landing_page_url: Optional[str] = Field(default=None, description="The landing page URL.")
|
||||
pdf_url: Optional[str] = Field(default=None, description="The PDF URL.")
|
||||
source: Optional[Source] = Field(default=None, description="The publication source.")
|
||||
license: Optional[str] = Field(default=None, description="The license label.")
|
||||
license_id: Optional[str] = Field(default=None, description="The license id.")
|
||||
is_accepted: Optional[bool] = Field(default=None, description="Whether this manuscript is accepted.")
|
||||
is_published: Optional[bool] = Field(default=None, description="Whether this manuscript is published.")
|
||||
|
||||
|
||||
class OpenAccess(OpenAlexModel):
|
||||
is_oa: Optional[bool] = Field(default=None, description="Whether the work is open access.")
|
||||
oa_url: Optional[str] = Field(default=None, description="The open access URL.")
|
||||
any_repository_has_fulltext: Optional[bool] = Field(default=None, description="Whether a repository has full text.")
|
||||
|
||||
|
||||
class Author(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The author id.")
|
||||
display_name: Optional[str] = Field(default=None, description="The display name of the author.")
|
||||
orcid: Optional[str] = Field(default=None, description="The optional ORCID of the author.")
|
||||
|
||||
|
||||
class Institution(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The institution id.")
|
||||
display_name: Optional[str] = Field(default=None, description="The institution display name.")
|
||||
ror: Optional[str] = Field(default=None, description="The ROR id.")
|
||||
country_code: Optional[str] = Field(default=None, description="The country code.")
|
||||
type: Optional[str] = Field(default=None, description="The institution type.")
|
||||
lineage: Optional[List[str]] = Field(default=None, description="The institution lineage.")
|
||||
|
||||
|
||||
class Authorship(OpenAlexModel):
|
||||
author: Optional[Author] = Field(default=None, description="The author.")
|
||||
institutions: List[Institution] = Field(default_factory=list, description="The author's institutions.")
|
||||
countries: List[str] = Field(default_factory=list, description="The author's countries.")
|
||||
is_corresponding: Optional[bool] = Field(default=None, description="Whether this author is corresponding.")
|
||||
raw_author_name: Optional[str] = Field(default=None, description="The raw author name.")
|
||||
raw_affiliation_strings: List[str] = Field(default_factory=list, description="The raw affiliation strings.")
|
||||
|
||||
|
||||
class WorkIds(OpenAlexModel):
|
||||
openalex: Optional[str] = Field(default=None, description="The OpenAlex id.")
|
||||
doi: Optional[str] = Field(default=None, description="The DOI.")
|
||||
mag: Optional[int] = Field(default=None, description="The MAG id.")
|
||||
pmid: Optional[str] = Field(default=None, description="The PubMed id.")
|
||||
pmcid: Optional[str] = Field(default=None, description="The PubMed Central id.")
|
||||
|
||||
|
||||
class Biblio(OpenAlexModel):
|
||||
volume: Optional[str] = Field(default=None, description="The volume.")
|
||||
issue: Optional[str] = Field(default=None, description="The issue.")
|
||||
first_page: Optional[str] = Field(default=None, description="The first page.")
|
||||
last_page: Optional[str] = Field(default=None, description="The last page.")
|
||||
|
||||
|
||||
class TopicLevel(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The topic level id.")
|
||||
display_name: Optional[str] = Field(default=None, description="The topic level display name.")
|
||||
|
||||
|
||||
class Topic(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The topic id.")
|
||||
display_name: Optional[str] = Field(default=None, description="The topic display name.")
|
||||
score: Optional[float] = Field(default=None, description="The topic score.")
|
||||
subfield: Optional[TopicLevel] = Field(default=None, description="The topic subfield.")
|
||||
field: Optional[TopicLevel] = Field(default=None, description="The topic field.")
|
||||
domain: Optional[TopicLevel] = Field(default=None, description="The topic domain.")
|
||||
|
||||
|
||||
class Keyword(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The keyword id.")
|
||||
display_name: Optional[str] = Field(default=None, description="The keyword display name.")
|
||||
score: Optional[float] = Field(default=None, description="The keyword score.")
|
||||
|
||||
|
||||
class Funder(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The funder id.")
|
||||
display_name: Optional[str] = Field(default=None, description="The funder display name.")
|
||||
ror: Optional[str] = Field(default=None, description="The ROR id.")
|
||||
|
||||
|
||||
class Award(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The award id.")
|
||||
display_name: Optional[str] = Field(default=None, description="The award display name.")
|
||||
funder_award_id: Optional[str] = Field(default=None, description="The funder award id.")
|
||||
funder_id: Optional[str] = Field(default=None, description="The funder id.")
|
||||
funder_display_name: Optional[str] = Field(default=None, description="The funder display name.")
|
||||
doi: Optional[str] = Field(default=None, description="The award DOI.")
|
||||
|
||||
|
||||
class CitationNormalizedPercentile(OpenAlexModel):
|
||||
value: Optional[float] = Field(default=None, description="The normalized citation percentile.")
|
||||
is_in_top_1_percent: Optional[bool] = Field(default=None, description="Whether the work is in the top 1 percent.")
|
||||
is_in_top_10_percent: Optional[bool] = Field(default=None, description="Whether the work is in the top 10 percent.")
|
||||
|
||||
|
||||
class CitedByPercentileYear(OpenAlexModel):
|
||||
min: Optional[int] = Field(default=None, description="The minimum percentile year.")
|
||||
max: Optional[int] = Field(default=None, description="The maximum percentile year.")
|
||||
|
||||
|
||||
class CountByYear(OpenAlexModel):
|
||||
year: Optional[int] = Field(default=None, description="The year.")
|
||||
cited_by_count: int = Field(default=0, description="The citation count for the year.")
|
||||
|
||||
|
||||
class SustainableDevelopmentGoal(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The sustainable development goal id.")
|
||||
display_name: Optional[str] = Field(default=None, description="The sustainable development goal display name.")
|
||||
score: Optional[float] = Field(default=None, description="The sustainable development goal score.")
|
||||
|
||||
|
||||
class Mesh(OpenAlexModel):
|
||||
descriptor_ui: Optional[str] = Field(default=None, description="The descriptor UI.")
|
||||
descriptor_name: Optional[str] = Field(default=None, description="The descriptor name.")
|
||||
qualifier_ui: Optional[str] = Field(default=None, description="The qualifier UI.")
|
||||
qualifier_name: Optional[str] = Field(default=None, description="The qualifier name.")
|
||||
is_major_topic: Optional[bool] = Field(default=None, description="Whether this is a major topic.")
|
||||
|
||||
|
||||
class HasContent(OpenAlexModel):
|
||||
pdf: Optional[bool] = Field(default=None, description="Whether PDF content exists.")
|
||||
grobid_xml: Optional[bool] = Field(default=None, description="Whether GROBID XML content exists.")
|
||||
|
||||
|
||||
class Work(OpenAlexModel):
|
||||
id: str = Field(description="The external id of the work.")
|
||||
doi: Optional[str] = Field(default=None, description="The optional DOI of the work.")
|
||||
title: Optional[str] = Field(default=None, description="The title of the work.")
|
||||
display_name: Optional[str] = Field(default=None, description="The display name of the work.")
|
||||
publication_year: Optional[int] = Field(default=None, description="The publication year.")
|
||||
publication_date: Optional[str] = Field(default=None, description="The publication date.")
|
||||
type: Optional[str] = Field(default=None, description="The work type.")
|
||||
language: Optional[str] = Field(default=None, description="The work language.")
|
||||
cited_by_count: int = Field(default=0, description="The number of citations.")
|
||||
is_retracted: Optional[bool] = Field(default=None, description="Whether the work is retracted.")
|
||||
is_paratext: Optional[bool] = Field(default=None, description="Whether the work is paratext.")
|
||||
primary_location: Optional[Location] = Field(default=None, description="The primary location.")
|
||||
locations: List[Location] = Field(default_factory=list, description="The work locations.")
|
||||
best_oa_location: Optional[Location] = Field(default=None, description="The best open access location.")
|
||||
open_access: Optional[OpenAccess] = Field(default=None, description="Open access information.")
|
||||
authorships: List[Authorship] = Field(default_factory=list, description="The authorships.")
|
||||
ids: Optional[WorkIds] = Field(default=None, description="External ids.")
|
||||
biblio: Optional[Biblio] = Field(default=None, description="Bibliographic information.")
|
||||
abstract_inverted_index: dict[str, List[int]] = Field(default_factory=dict, description="The inverted abstract index.")
|
||||
referenced_works: List[str] = Field(default_factory=list, description="Referenced work ids.")
|
||||
referenced_works_count: int = Field(default=0, description="The number of referenced works.")
|
||||
related_works: List[str] = Field(default_factory=list, description="Related work ids.")
|
||||
topics: List[Topic] = Field(default_factory=list, description="The topics.")
|
||||
primary_topic: Optional[Topic] = Field(default=None, description="The primary topic.")
|
||||
keywords: List[Keyword] = Field(default_factory=list, description="The keywords.")
|
||||
funders: List[Funder] = Field(default_factory=list, description="The funders.")
|
||||
awards: List[Award] = Field(default_factory=list, description="The awards.")
|
||||
fwci: Optional[float] = Field(default=None, description="The field weighted citation impact.")
|
||||
citation_normalized_percentile: Optional[CitationNormalizedPercentile] = Field(default=None, description="The normalized citation percentile.")
|
||||
cited_by_percentile_year: Optional[CitedByPercentileYear] = Field(default=None, description="The cited by percentile year.")
|
||||
counts_by_year: List[CountByYear] = Field(default_factory=list, description="Citation counts by year.")
|
||||
sustainable_development_goals: List[SustainableDevelopmentGoal] = Field(default_factory=list, description="Sustainable development goals.")
|
||||
mesh: List[Mesh] = Field(default_factory=list, description="MeSH terms.")
|
||||
indexed_in: List[str] = Field(default_factory=list, description="Indexes containing the work.")
|
||||
has_content: Optional[HasContent] = Field(default=None, description="Available content flags.")
|
||||
content_url: Optional[str] = Field(default=None, description="The content URL.")
|
||||
created_date: Optional[str] = Field(default=None, description="The creation date.")
|
||||
updated_date: Optional[str] = Field(default=None, description="The last update timestamp.")
|
||||
|
||||
|
||||
class WorkSummary(BaseModel):
|
||||
doi: Optional[str] = Field(default=None, description="The optional DOI of the work.")
|
||||
title: Optional[str] = Field(default=None, description="The title of the work.")
|
||||
type: Optional[str] = Field(default=None, description="The work type.")
|
||||
language: Optional[str] = Field(default=None, description="The work language.")
|
||||
publication_year: Optional[int] = Field(default=None, description="The publication year.")
|
||||
cited_by_count: int = Field(default=0, description="The number of citations.")
|
||||
topics: List[str] = Field(default_factory=list, description="The display names of the work topics.")
|
||||
|
||||
|
||||
class WorkPage(BaseModel):
|
||||
elements: List[WorkSummary] = Field(default_factory=list, description="The works on this page.")
|
||||
page: int = Field(default=1, description="The current page number.")
|
||||
size: int = Field(default=20, description="The requested page size.")
|
||||
total: int = Field(default=0, description="The total number of works.")
|
||||
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
HTTP client for the OpenAlex works Elasticsearch index.
|
||||
"""
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
|
||||
from .. import config
|
||||
|
||||
|
||||
class MissingApiKeyError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class OpenAlexWorksSearchClient:
|
||||
def __init__(
|
||||
self,
|
||||
base_url: str | None = None,
|
||||
index: str | None = None,
|
||||
api_key: str | None = None,
|
||||
timeout: float | None = None,
|
||||
transport: httpx.AsyncBaseTransport | None = None,
|
||||
):
|
||||
self.base_url = (base_url or config.settings.openalex_works_search_base_url).rstrip("/")
|
||||
self.index = index or config.settings.openalex_works_search_index
|
||||
self.api_key = api_key if api_key is not None else config.settings.openalex_works_api_key
|
||||
self.timeout = timeout if timeout is not None else config.settings.openalex_works_search_timeout_seconds
|
||||
self.transport = transport
|
||||
|
||||
def author_works_query(self, author_id: str, page: int, size: int) -> dict[str, Any]:
|
||||
indexed_author_id = f"https://openalex.org/{author_id.strip()}"
|
||||
return {
|
||||
"from": (page - 1) * size,
|
||||
"size": size,
|
||||
"query": {
|
||||
"nested": {
|
||||
"path": "authorships",
|
||||
"query": {
|
||||
"term": {
|
||||
"authorships.author.id": indexed_author_id,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"sort": [
|
||||
{"publication_year": {"order": "desc", "missing": "_last"}},
|
||||
{"cited_by_count": {"order": "desc", "missing": "_last"}},
|
||||
],
|
||||
}
|
||||
|
||||
async def search_author_works(self, author_id: str, page: int, size: int) -> dict[str, Any]:
|
||||
if not self.api_key:
|
||||
raise MissingApiKeyError("OpenAlex works Elasticsearch API key is not configured.")
|
||||
|
||||
async with httpx.AsyncClient(
|
||||
base_url=self.base_url,
|
||||
timeout=self.timeout,
|
||||
transport=self.transport,
|
||||
) as client:
|
||||
response = await client.post(
|
||||
f"/{self.index}/_search",
|
||||
headers={"Authorization": f"ApiKey {self.api_key}"},
|
||||
json=self.author_works_query(author_id, page, size),
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
REST API for publication works.
|
||||
"""
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import APIRouter
|
||||
from fastapi import Depends
|
||||
from fastapi import Path
|
||||
from fastapi import Query
|
||||
|
||||
from .. import security
|
||||
from . import logic
|
||||
from . import model
|
||||
|
||||
|
||||
router = APIRouter(prefix="/authors", tags=["Works"])
|
||||
|
||||
|
||||
@router.get("/{author_id}/works",
|
||||
operation_id="getAuthorWorks",
|
||||
response_model=model.WorkPage,
|
||||
summary="Returns a page of works for an author.")
|
||||
async def get_author_works(
|
||||
author_id: Annotated[str, Path(description="The author id, for example A5023888391.")],
|
||||
page: Annotated[int, Query(description="The page number.", ge=1)] = 1,
|
||||
size: Annotated[int, Query(description="The page size.", ge=1, le=100)] = 20,
|
||||
principal: security.Principal = Depends(security.roles_allowed(["SUPER_ADMIN", "UNI_ADMIN"])),
|
||||
):
|
||||
return await logic.get_author_works(author_id, page, size)
|
||||
@@ -0,0 +1,103 @@
|
||||
import httpx
|
||||
import pytest
|
||||
from fastapi import HTTPException
|
||||
|
||||
from inse.works import logic
|
||||
from inse.works.search_client import OpenAlexWorksSearchClient
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def anyio_backend():
|
||||
return "asyncio"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_get_author_works_maps_elasticsearch_response_to_work_page():
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
return httpx.Response(
|
||||
200,
|
||||
json={
|
||||
"hits": {
|
||||
"total": {"value": 1},
|
||||
"hits": [
|
||||
{
|
||||
"_source": {
|
||||
"id": "https://openalex.org/W2741809807",
|
||||
"doi": "https://doi.org/10.7717/peerj.4375",
|
||||
"display_name": "Example work",
|
||||
"type": "article",
|
||||
"language": "en",
|
||||
"publication_year": 2023,
|
||||
"cited_by_count": 42,
|
||||
"topics": [
|
||||
{
|
||||
"id": "https://openalex.org/T10102",
|
||||
"display_name": "Machine learning",
|
||||
"score": 0.91,
|
||||
}
|
||||
],
|
||||
"primary_location": {
|
||||
"source": {
|
||||
"id": "https://openalex.org/S123",
|
||||
"display_name": "Example Source",
|
||||
"issn": None,
|
||||
}
|
||||
},
|
||||
"authorships": [
|
||||
{
|
||||
"author": {
|
||||
"id": "https://openalex.org/A5023888391",
|
||||
"display_name": "Example Author",
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
client = OpenAlexWorksSearchClient(
|
||||
base_url="https://project.nes.uni-due.de/elastic",
|
||||
api_key="test-key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
page = await logic.get_author_works("A5023888391", page=1, size=20, client=client)
|
||||
|
||||
assert page.total == 1
|
||||
assert page.elements[0].doi == "https://doi.org/10.7717/peerj.4375"
|
||||
assert page.elements[0].title == "Example work"
|
||||
assert page.elements[0].type == "article"
|
||||
assert page.elements[0].language == "en"
|
||||
assert page.elements[0].publication_year == 2023
|
||||
assert page.elements[0].cited_by_count == 42
|
||||
assert page.elements[0].topics == ["Machine learning"]
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_get_author_works_maps_missing_api_key_to_service_unavailable():
|
||||
client = OpenAlexWorksSearchClient(api_key="")
|
||||
|
||||
with pytest.raises(HTTPException) as exc:
|
||||
await logic.get_author_works("A5023888391", page=1, size=20, client=client)
|
||||
|
||||
assert exc.value.status_code == 503
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_get_author_works_maps_elasticsearch_errors_to_bad_gateway():
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
return httpx.Response(500, json={"error": "upstream failed"})
|
||||
|
||||
client = OpenAlexWorksSearchClient(
|
||||
base_url="https://project.nes.uni-due.de/elastic",
|
||||
api_key="test-key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
with pytest.raises(HTTPException) as exc:
|
||||
await logic.get_author_works("A5023888391", page=1, size=20, client=client)
|
||||
|
||||
assert exc.value.status_code == 502
|
||||
@@ -0,0 +1,49 @@
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from inse.works.search_client import MissingApiKeyError
|
||||
from inse.works.search_client import OpenAlexWorksSearchClient
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def anyio_backend():
|
||||
return "asyncio"
|
||||
|
||||
|
||||
def test_author_works_query_searches_authorship_author_id():
|
||||
client = OpenAlexWorksSearchClient(api_key="test-key")
|
||||
|
||||
query = client.author_works_query("A5023888391", page=2, size=25)
|
||||
|
||||
assert query["from"] == 25
|
||||
assert query["size"] == 25
|
||||
assert query["query"]["nested"]["path"] == "authorships"
|
||||
assert query["query"]["nested"]["query"]["term"]["authorships.author.id"] == "https://openalex.org/A5023888391"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_search_author_works_calls_elasticsearch_index_with_api_key():
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
assert request.method == "POST"
|
||||
assert request.url.path == "/elastic/openalex-works/_search"
|
||||
assert request.headers["Authorization"] == "ApiKey test-key"
|
||||
return httpx.Response(200, json={"hits": {"total": {"value": 0}, "hits": []}})
|
||||
|
||||
client = OpenAlexWorksSearchClient(
|
||||
base_url="https://project.nes.uni-due.de/elastic",
|
||||
index="openalex-works",
|
||||
api_key="test-key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
result = await client.search_author_works("A5023888391", page=1, size=20)
|
||||
|
||||
assert result == {"hits": {"total": {"value": 0}, "hits": []}}
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_search_author_works_requires_api_key():
|
||||
client = OpenAlexWorksSearchClient(api_key="")
|
||||
|
||||
with pytest.raises(MissingApiKeyError):
|
||||
await client.search_author_works("A5023888391", page=1, size=20)
|
||||
@@ -0,0 +1,53 @@
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from inse import config
|
||||
from inse.works import logic
|
||||
from inse.works import model
|
||||
from inse.main import app
|
||||
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
|
||||
def test_get_author_works_returns_page(monkeypatch):
|
||||
config.settings.auth_disabled = True
|
||||
|
||||
async def fake_get_author_works(author_id: str, page: int, size: int):
|
||||
assert author_id == "A5023888391"
|
||||
assert page == 2
|
||||
assert size == 5
|
||||
return model.WorkPage(
|
||||
elements=[
|
||||
model.WorkSummary(
|
||||
doi="https://doi.org/10.7717/peerj.4375",
|
||||
title="Example work",
|
||||
type="article",
|
||||
language="en",
|
||||
publication_year=2023,
|
||||
cited_by_count=42,
|
||||
topics=["Machine learning"],
|
||||
)
|
||||
],
|
||||
page=page,
|
||||
size=size,
|
||||
total=1,
|
||||
)
|
||||
|
||||
monkeypatch.setattr(logic, "get_author_works", fake_get_author_works)
|
||||
|
||||
response = client.get("/inse-service/authors/A5023888391/works?page=2&size=5")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["page"] == 2
|
||||
assert data["size"] == 5
|
||||
assert data["total"] == 1
|
||||
assert data["elements"][0] == {
|
||||
"doi": "https://doi.org/10.7717/peerj.4375",
|
||||
"title": "Example work",
|
||||
"type": "article",
|
||||
"language": "en",
|
||||
"publication_year": 2023,
|
||||
"cited_by_count": 42,
|
||||
"topics": ["Machine learning"],
|
||||
}
|
||||
@@ -6,6 +6,24 @@ Angular 18 single-page application with Angular Material.
|
||||
|
||||
Run `npm start` for a dev server at `http://localhost:4200/`. The application will automatically reload on file changes.
|
||||
|
||||
## OpenAPI Client
|
||||
|
||||
Gradle exports the backend OpenAPI schema from the FastAPI app and generates the Angular client from that schema:
|
||||
|
||||
```bash
|
||||
../gradlew :webapp:generateOpenApiClient
|
||||
```
|
||||
|
||||
The generated client is written to `src/app/api`. The schema file is written to `../service/build/openapi/inse-service.openapi.json`.
|
||||
|
||||
If the schema was already exported, the npm script can regenerate only the frontend client:
|
||||
|
||||
```bash
|
||||
npm run generate:api
|
||||
```
|
||||
|
||||
Use the generated services for new backend endpoints so request models, response models, and operation names stay aligned with the FastAPI OpenAPI schema.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
+6
-1
@@ -25,6 +25,12 @@ task serve(type: NodeTask) {
|
||||
args = ['serve', '--configuration', 'development', '--proxy-config', 'src/proxy.conf.json', '--open']
|
||||
workingDir = projectDir
|
||||
}
|
||||
|
||||
task generateOpenApiClient(type: Exec) {
|
||||
dependsOn ':service:exportOpenApiSpec'
|
||||
commandLine 'npm', 'run', 'generate:api'
|
||||
workingDir = projectDir
|
||||
}
|
||||
|
||||
build {
|
||||
dependsOn ngBuild
|
||||
@@ -33,4 +39,3 @@ build {
|
||||
clean {
|
||||
dependsOn cleanNgBuild
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
.gitignore
|
||||
.npmignore
|
||||
.openapi-generator-ignore
|
||||
README.md
|
||||
git_push.sh
|
||||
package.json
|
||||
ng-package.json
|
||||
tsconfig.json
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
|
||||
"generator-cli": {
|
||||
"version": "7.17.0",
|
||||
"generators": {
|
||||
"inse-service": {
|
||||
"generatorName": "typescript-angular",
|
||||
"inputSpec": "../service/build/openapi/inse-service.openapi.json",
|
||||
"output": "src/app/api",
|
||||
"ignoreFileOverride": "openapi-generator-ignore",
|
||||
"additionalProperties": {
|
||||
"ngVersion": "21.2.14",
|
||||
"providedInRoot": true,
|
||||
"serviceSuffix": "OpenApiService",
|
||||
"withInterfaces": true,
|
||||
"enumPropertyNaming": "original",
|
||||
"fileNaming": "kebab-case"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+1462
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
"generate:api": "openapi-generator-cli generate --generator-key inse-service",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test"
|
||||
},
|
||||
@@ -30,6 +31,7 @@
|
||||
"@angular/build": "^21.2.12",
|
||||
"@angular/cli": "^21.2.12",
|
||||
"@angular/compiler-cli": "^21.2.14",
|
||||
"@openapitools/openapi-generator-cli": "^2.34.0",
|
||||
"@types/jasmine": "~5.1.0",
|
||||
"jasmine-core": "~5.1.0",
|
||||
"karma": "~6.4.0",
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
wwwroot/*.js
|
||||
node_modules
|
||||
typings
|
||||
dist
|
||||
@@ -0,0 +1,23 @@
|
||||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
||||
@@ -0,0 +1,31 @@
|
||||
.gitignore
|
||||
README.md
|
||||
api.base.service.ts
|
||||
api.module.ts
|
||||
api/api.ts
|
||||
api/items.service.ts
|
||||
api/items.serviceInterface.ts
|
||||
api/persons.service.ts
|
||||
api/persons.serviceInterface.ts
|
||||
api/works.service.ts
|
||||
api/works.serviceInterface.ts
|
||||
configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/affiliation.ts
|
||||
model/http-validation-error.ts
|
||||
model/item-create.ts
|
||||
model/item-page.ts
|
||||
model/item.ts
|
||||
model/models.ts
|
||||
model/person-bio.ts
|
||||
model/person-search-result.ts
|
||||
model/person.ts
|
||||
model/validation-error-loc-inner.ts
|
||||
model/validation-error.ts
|
||||
model/work-page.ts
|
||||
model/work-summary.ts
|
||||
param.ts
|
||||
provide-api.ts
|
||||
variables.ts
|
||||
@@ -0,0 +1 @@
|
||||
7.17.0
|
||||
@@ -0,0 +1,185 @@
|
||||
# @
|
||||
|
||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
## Building
|
||||
|
||||
To install the required dependencies and to build the typescript sources run:
|
||||
|
||||
```console
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Publishing
|
||||
|
||||
First build the package then run `npm publish dist` (don't forget to specify the `dist` folder!)
|
||||
|
||||
## Consuming
|
||||
|
||||
Navigate to the folder of your consuming project and run one of next commands.
|
||||
|
||||
_published:_
|
||||
|
||||
```console
|
||||
npm install @ --save
|
||||
```
|
||||
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```console
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE/dist:
|
||||
|
||||
```console
|
||||
npm link
|
||||
```
|
||||
|
||||
In your project:
|
||||
|
||||
```console
|
||||
npm link
|
||||
```
|
||||
|
||||
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
|
||||
Please refer to this issue <https://github.com/angular/angular-cli/issues/8284> for a solution / workaround.
|
||||
Published packages are not effected by this issue.
|
||||
|
||||
### General usage
|
||||
|
||||
In your Angular project:
|
||||
|
||||
```typescript
|
||||
|
||||
import { ApplicationConfig } from '@angular/core';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideApi } from '';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
// ...
|
||||
provideHttpClient(),
|
||||
provideApi()
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
**NOTE**
|
||||
If you're still using `AppModule` and haven't [migrated](https://angular.dev/reference/migrations/standalone) yet, you can still import an Angular module:
|
||||
```typescript
|
||||
import { ApiModule } from '';
|
||||
```
|
||||
|
||||
If different from the generated base path, during app bootstrap, you can provide the base path to your service.
|
||||
|
||||
```typescript
|
||||
import { ApplicationConfig } from '@angular/core';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideApi } from '';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
// ...
|
||||
provideHttpClient(),
|
||||
provideApi('http://localhost:9999')
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
```typescript
|
||||
// with a custom configuration
|
||||
import { ApplicationConfig } from '@angular/core';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideApi } from '';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
// ...
|
||||
provideHttpClient(),
|
||||
provideApi({
|
||||
withCredentials: true,
|
||||
username: 'user',
|
||||
password: 'password'
|
||||
})
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
```typescript
|
||||
// with factory building a custom configuration
|
||||
import { ApplicationConfig } from '@angular/core';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideApi, Configuration } from '';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
// ...
|
||||
provideHttpClient(),
|
||||
{
|
||||
provide: Configuration,
|
||||
useFactory: (authService: AuthService) => new Configuration({
|
||||
basePath: 'http://localhost:9999',
|
||||
withCredentials: true,
|
||||
username: authService.getUsername(),
|
||||
password: authService.getPassword(),
|
||||
}),
|
||||
deps: [AuthService],
|
||||
multi: false
|
||||
}
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
### Using multiple OpenAPI files / APIs
|
||||
|
||||
In order to use multiple APIs generated from different OpenAPI files,
|
||||
you can create an alias name when importing the modules
|
||||
in order to avoid naming conflicts:
|
||||
|
||||
```typescript
|
||||
import { provideApi as provideUserApi } from 'my-user-api-path';
|
||||
import { provideApi as provideAdminApi } from 'my-admin-api-path';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { environment } from '../environments/environment';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
// ...
|
||||
provideHttpClient(),
|
||||
provideUserApi(environment.basePath),
|
||||
provideAdminApi(environment.basePath),
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
### Customizing path parameter encoding
|
||||
|
||||
Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple'
|
||||
and Dates for format 'date-time' are encoded correctly.
|
||||
|
||||
Other styles (e.g. "matrix") are not that easy to encode
|
||||
and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]).
|
||||
|
||||
To implement your own parameter encoding (or call another library),
|
||||
pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object
|
||||
(see [General Usage](#general-usage) above).
|
||||
|
||||
Example value for use in your Configuration-Provider:
|
||||
|
||||
```typescript
|
||||
new Configuration({
|
||||
encodeParam: (param: Param) => myFancyParamEncoder(param),
|
||||
})
|
||||
```
|
||||
|
||||
[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations
|
||||
[style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values
|
||||
[@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander
|
||||
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from './encoder';
|
||||
import { Configuration } from './configuration';
|
||||
|
||||
export class BaseService {
|
||||
protected basePath = 'http://localhost';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration: Configuration;
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(basePath?: string|string[], configuration?: Configuration) {
|
||||
this.configuration = configuration || new Configuration();
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||
if (firstBasePath != undefined) {
|
||||
basePath = firstBasePath;
|
||||
}
|
||||
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
||||
protected canConsumeForm(consumes: string[]): boolean {
|
||||
return consumes.indexOf('multipart/form-data') !== -1;
|
||||
}
|
||||
|
||||
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep: boolean = false): HttpParams {
|
||||
// If the value is an object (but not a Date), recursively add its keys.
|
||||
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||
return this.addToHttpParamsRecursive(httpParams, value, isDeep ? key : undefined, isDeep);
|
||||
}
|
||||
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||
}
|
||||
|
||||
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep: boolean = false): HttpParams {
|
||||
if (value === null || value === undefined) {
|
||||
return httpParams;
|
||||
}
|
||||
if (typeof value === 'object') {
|
||||
// If JSON format is preferred, key must be provided.
|
||||
if (key != null) {
|
||||
return isDeep
|
||||
? Object.keys(value as Record<string, any>).reduce(
|
||||
(hp, k) => hp.append(`${key}[${k}]`, value[k]),
|
||||
httpParams,
|
||||
)
|
||||
: httpParams.append(key, JSON.stringify(value));
|
||||
}
|
||||
// Otherwise, if it's an array, add each element.
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||
} else if (value instanceof Date) {
|
||||
if (key != null) {
|
||||
httpParams = httpParams.append(key, value.toISOString());
|
||||
} else {
|
||||
throw Error("key may not be null if value is Date");
|
||||
}
|
||||
} else {
|
||||
Object.keys(value).forEach(k => {
|
||||
const paramKey = key ? `${key}.${k}` : k;
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||
});
|
||||
}
|
||||
return httpParams;
|
||||
} else if (key != null) {
|
||||
return httpParams.append(key, value);
|
||||
}
|
||||
throw Error("key may not be null if value is not object or array");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
|
||||
import { Configuration } from './configuration';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [],
|
||||
declarations: [],
|
||||
exports: [],
|
||||
providers: []
|
||||
})
|
||||
export class ApiModule {
|
||||
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders<ApiModule> {
|
||||
return {
|
||||
ngModule: ApiModule,
|
||||
providers: [ { provide: Configuration, useFactory: configurationFactory } ]
|
||||
};
|
||||
}
|
||||
|
||||
constructor( @Optional() @SkipSelf() parentModule: ApiModule,
|
||||
@Optional() http: HttpClient) {
|
||||
if (parentModule) {
|
||||
throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
|
||||
}
|
||||
if (!http) {
|
||||
throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
|
||||
'See also https://github.com/angular/angular/issues/20575');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
export * from './items.service';
|
||||
import { ItemsOpenApiService } from './items.service';
|
||||
export * from './items.serviceInterface';
|
||||
export * from './persons.service';
|
||||
import { PersonsOpenApiService } from './persons.service';
|
||||
export * from './persons.serviceInterface';
|
||||
export * from './works.service';
|
||||
import { WorksOpenApiService } from './works.service';
|
||||
export * from './works.serviceInterface';
|
||||
export const APIS = [ItemsOpenApiService, PersonsOpenApiService, WorksOpenApiService];
|
||||
@@ -0,0 +1,366 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/http-validation-error';
|
||||
// @ts-ignore
|
||||
import { Item } from '../model/item';
|
||||
// @ts-ignore
|
||||
import { ItemCreate } from '../model/item-create';
|
||||
// @ts-ignore
|
||||
import { ItemPage } from '../model/item-page';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
import {
|
||||
ItemsOpenApiServiceInterface
|
||||
} from './items.serviceInterface';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ItemsOpenApiService extends BaseService implements ItemsOpenApiServiceInterface {
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new item.
|
||||
* @endpoint post /items
|
||||
* @param itemCreate
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public addItem(itemCreate: ItemCreate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Item>;
|
||||
public addItem(itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Item>>;
|
||||
public addItem(itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Item>>;
|
||||
public addItem(itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (itemCreate === null || itemCreate === undefined) {
|
||||
throw new Error('Required parameter itemCreate was null or undefined when calling addItem.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
||||
}
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/items`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Item>('post', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: itemCreate,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the item with the id.
|
||||
* @endpoint delete /items/{id}
|
||||
* @param id The item id.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public deleteItem(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>;
|
||||
public deleteItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
|
||||
public deleteItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
|
||||
public deleteItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (id === null || id === undefined) {
|
||||
throw new Error('Required parameter id was null or undefined when calling deleteItem.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<any>('delete', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the item with the id.
|
||||
* @endpoint get /items/{id}
|
||||
* @param id The item id.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getItem(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Item>;
|
||||
public getItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Item>>;
|
||||
public getItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Item>>;
|
||||
public getItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (id === null || id === undefined) {
|
||||
throw new Error('Required parameter id was null or undefined when calling getItem.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Item>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a page of items.
|
||||
* @endpoint get /items
|
||||
* @param pageOffset The page offset.
|
||||
* @param pageSize The page size.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getItems(pageOffset?: number, pageSize?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<ItemPage>;
|
||||
public getItems(pageOffset?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ItemPage>>;
|
||||
public getItems(pageOffset?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ItemPage>>;
|
||||
public getItems(pageOffset?: number, pageSize?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>pageOffset, 'pageOffset');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>pageSize, 'pageSize');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/items`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<ItemPage>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the item with the id.
|
||||
* @endpoint put /items/{id}
|
||||
* @param id The item id.
|
||||
* @param itemCreate
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public updateItem(id: number, itemCreate: ItemCreate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Item>;
|
||||
public updateItem(id: number, itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Item>>;
|
||||
public updateItem(id: number, itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Item>>;
|
||||
public updateItem(id: number, itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (id === null || id === undefined) {
|
||||
throw new Error('Required parameter id was null or undefined when calling updateItem.');
|
||||
}
|
||||
if (itemCreate === null || itemCreate === undefined) {
|
||||
throw new Error('Required parameter itemCreate was null or undefined when calling updateItem.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
||||
}
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Item>('put', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: itemCreate,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
import { Item } from '../model/models';
|
||||
import { ItemCreate } from '../model/models';
|
||||
import { ItemPage } from '../model/models';
|
||||
|
||||
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
export interface ItemsOpenApiServiceInterface {
|
||||
defaultHeaders: HttpHeaders;
|
||||
configuration: Configuration;
|
||||
|
||||
/**
|
||||
* Adds a new item.
|
||||
*
|
||||
* @endpoint post /items
|
||||
* @param itemCreate
|
||||
*/
|
||||
addItem(itemCreate: ItemCreate, extraHttpRequestParams?: any): Observable<Item>;
|
||||
|
||||
/**
|
||||
* Deletes the item with the id.
|
||||
*
|
||||
* @endpoint delete /items/{id}
|
||||
* @param id The item id.
|
||||
*/
|
||||
deleteItem(id: number, extraHttpRequestParams?: any): Observable<any>;
|
||||
|
||||
/**
|
||||
* Returns the item with the id.
|
||||
*
|
||||
* @endpoint get /items/{id}
|
||||
* @param id The item id.
|
||||
*/
|
||||
getItem(id: number, extraHttpRequestParams?: any): Observable<Item>;
|
||||
|
||||
/**
|
||||
* Returns a page of items.
|
||||
*
|
||||
* @endpoint get /items
|
||||
* @param pageOffset The page offset.
|
||||
* @param pageSize The page size.
|
||||
*/
|
||||
getItems(pageOffset?: number, pageSize?: number, extraHttpRequestParams?: any): Observable<ItemPage>;
|
||||
|
||||
/**
|
||||
* Updates the item with the id.
|
||||
*
|
||||
* @endpoint put /items/{id}
|
||||
* @param id The item id.
|
||||
* @param itemCreate
|
||||
*/
|
||||
updateItem(id: number, itemCreate: ItemCreate, extraHttpRequestParams?: any): Observable<Item>;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/http-validation-error';
|
||||
// @ts-ignore
|
||||
import { PersonBio } from '../model/person-bio';
|
||||
// @ts-ignore
|
||||
import { PersonSearchResult } from '../model/person-search-result';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
import {
|
||||
PersonsOpenApiServiceInterface
|
||||
} from './persons.serviceInterface';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PersonsOpenApiService extends BaseService implements PersonsOpenApiServiceInterface {
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a bio for a person by author ID.
|
||||
* @endpoint get /persons/bio
|
||||
* @param authorId OpenAlex author ID (e.g., A5093075883)
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public generatePersonBio(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<PersonBio>;
|
||||
public generatePersonBio(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PersonBio>>;
|
||||
public generatePersonBio(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PersonBio>>;
|
||||
public generatePersonBio(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (authorId === null || authorId === undefined) {
|
||||
throw new Error('Required parameter authorId was null or undefined when calling generatePersonBio.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>authorId, 'author_id');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/persons/bio`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<PersonBio>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for persons by ID or name.
|
||||
* @endpoint get /persons/search
|
||||
* @param authorId OpenAlex author ID (e.g., A5093075883)
|
||||
* @param query Search query (e.g., Arman AND Arzani)
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public searchPersons(authorId?: string, query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<PersonSearchResult>;
|
||||
public searchPersons(authorId?: string, query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PersonSearchResult>>;
|
||||
public searchPersons(authorId?: string, query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PersonSearchResult>>;
|
||||
public searchPersons(authorId?: string, query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>authorId, 'author_id');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>query, 'query');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/persons/search`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<PersonSearchResult>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
import { PersonBio } from '../model/models';
|
||||
import { PersonSearchResult } from '../model/models';
|
||||
|
||||
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
export interface PersonsOpenApiServiceInterface {
|
||||
defaultHeaders: HttpHeaders;
|
||||
configuration: Configuration;
|
||||
|
||||
/**
|
||||
* Generates a bio for a person by author ID.
|
||||
*
|
||||
* @endpoint get /persons/bio
|
||||
* @param authorId OpenAlex author ID (e.g., A5093075883)
|
||||
*/
|
||||
generatePersonBio(authorId: string, extraHttpRequestParams?: any): Observable<PersonBio>;
|
||||
|
||||
/**
|
||||
* Searches for persons by ID or name.
|
||||
*
|
||||
* @endpoint get /persons/search
|
||||
* @param authorId OpenAlex author ID (e.g., A5093075883)
|
||||
* @param query Search query (e.g., Arman AND Arzani)
|
||||
*/
|
||||
searchPersons(authorId?: string, query?: string, extraHttpRequestParams?: any): Observable<PersonSearchResult>;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/http-validation-error';
|
||||
// @ts-ignore
|
||||
import { WorkPage } from '../model/work-page';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
import {
|
||||
WorksOpenApiServiceInterface
|
||||
} from './works.serviceInterface';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class WorksOpenApiService extends BaseService implements WorksOpenApiServiceInterface {
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a page of works for an author.
|
||||
* @endpoint get /authors/{author_id}/works
|
||||
* @param authorId The author id, for example A5023888391.
|
||||
* @param page The page number.
|
||||
* @param size The page size.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getAuthorWorks(authorId: string, page?: number, size?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<WorkPage>;
|
||||
public getAuthorWorks(authorId: string, page?: number, size?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<WorkPage>>;
|
||||
public getAuthorWorks(authorId: string, page?: number, size?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<WorkPage>>;
|
||||
public getAuthorWorks(authorId: string, page?: number, size?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (authorId === null || authorId === undefined) {
|
||||
throw new Error('Required parameter authorId was null or undefined when calling getAuthorWorks.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>page, 'page');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>size, 'size');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/works`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<WorkPage>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
import { WorkPage } from '../model/models';
|
||||
|
||||
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
export interface WorksOpenApiServiceInterface {
|
||||
defaultHeaders: HttpHeaders;
|
||||
configuration: Configuration;
|
||||
|
||||
/**
|
||||
* Returns a page of works for an author.
|
||||
*
|
||||
* @endpoint get /authors/{author_id}/works
|
||||
* @param authorId The author id, for example A5023888391.
|
||||
* @param page The page number.
|
||||
* @param size The page size.
|
||||
*/
|
||||
getAuthorWorks(authorId: string, page?: number, size?: number, extraHttpRequestParams?: any): Observable<WorkPage>;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||
import { Param } from './param';
|
||||
|
||||
export interface ConfigurationParameters {
|
||||
/**
|
||||
* @deprecated Since 5.0. Use credentials instead
|
||||
*/
|
||||
apiKeys?: {[ key: string ]: string};
|
||||
username?: string;
|
||||
password?: string;
|
||||
/**
|
||||
* @deprecated Since 5.0. Use credentials instead
|
||||
*/
|
||||
accessToken?: string | (() => string);
|
||||
basePath?: string;
|
||||
withCredentials?: boolean;
|
||||
/**
|
||||
* Takes care of encoding query- and form-parameters.
|
||||
*/
|
||||
encoder?: HttpParameterCodec;
|
||||
/**
|
||||
* Override the default method for encoding path parameters in various
|
||||
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
|
||||
* <p>
|
||||
* See {@link README.md} for more details
|
||||
* </p>
|
||||
*/
|
||||
encodeParam?: (param: Param) => string;
|
||||
/**
|
||||
* The keys are the names in the securitySchemes section of the OpenAPI
|
||||
* document. They should map to the value used for authentication
|
||||
* minus any standard prefixes such as 'Basic' or 'Bearer'.
|
||||
*/
|
||||
credentials?: {[ key: string ]: string | (() => string | undefined)};
|
||||
}
|
||||
|
||||
export class Configuration {
|
||||
/**
|
||||
* @deprecated Since 5.0. Use credentials instead
|
||||
*/
|
||||
apiKeys?: {[ key: string ]: string};
|
||||
username?: string;
|
||||
password?: string;
|
||||
/**
|
||||
* @deprecated Since 5.0. Use credentials instead
|
||||
*/
|
||||
accessToken?: string | (() => string);
|
||||
basePath?: string;
|
||||
withCredentials?: boolean;
|
||||
/**
|
||||
* Takes care of encoding query- and form-parameters.
|
||||
*/
|
||||
encoder?: HttpParameterCodec;
|
||||
/**
|
||||
* Encoding of various path parameter
|
||||
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
|
||||
* <p>
|
||||
* See {@link README.md} for more details
|
||||
* </p>
|
||||
*/
|
||||
encodeParam: (param: Param) => string;
|
||||
/**
|
||||
* The keys are the names in the securitySchemes section of the OpenAPI
|
||||
* document. They should map to the value used for authentication
|
||||
* minus any standard prefixes such as 'Basic' or 'Bearer'.
|
||||
*/
|
||||
credentials: {[ key: string ]: string | (() => string | undefined)};
|
||||
|
||||
constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) {
|
||||
if (apiKeys) {
|
||||
this.apiKeys = apiKeys;
|
||||
}
|
||||
if (username !== undefined) {
|
||||
this.username = username;
|
||||
}
|
||||
if (password !== undefined) {
|
||||
this.password = password;
|
||||
}
|
||||
if (accessToken !== undefined) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
if (basePath !== undefined) {
|
||||
this.basePath = basePath;
|
||||
}
|
||||
if (withCredentials !== undefined) {
|
||||
this.withCredentials = withCredentials;
|
||||
}
|
||||
if (encoder) {
|
||||
this.encoder = encoder;
|
||||
}
|
||||
this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param));
|
||||
this.credentials = credentials ?? {};
|
||||
|
||||
// init default bearer credential
|
||||
if (!this.credentials['bearer']) {
|
||||
this.credentials['bearer'] = () => {
|
||||
return typeof this.accessToken === 'function'
|
||||
? this.accessToken()
|
||||
: this.accessToken;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the correct content-type to use for a request.
|
||||
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
|
||||
* If no content type is found return the first found type if the contentTypes is not empty
|
||||
* @param contentTypes - the array of content types that are available for selection
|
||||
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
|
||||
*/
|
||||
public selectHeaderContentType (contentTypes: string[]): string | undefined {
|
||||
if (contentTypes.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const type = contentTypes.find((x: string) => this.isJsonMime(x));
|
||||
if (type === undefined) {
|
||||
return contentTypes[0];
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the correct accept content-type to use for a request.
|
||||
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
|
||||
* If no content type is found return the first found type if the contentTypes is not empty
|
||||
* @param accepts - the array of content types that are available for selection.
|
||||
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
|
||||
*/
|
||||
public selectHeaderAccept(accepts: string[]): string | undefined {
|
||||
if (accepts.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const type = accepts.find((x: string) => this.isJsonMime(x));
|
||||
if (type === undefined) {
|
||||
return accepts[0];
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* application/vnd.company+json
|
||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
public isJsonMime(mime: string): boolean {
|
||||
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||
}
|
||||
|
||||
public lookupCredential(key: string): string | undefined {
|
||||
const value = this.credentials[key];
|
||||
return typeof value === 'function'
|
||||
? value()
|
||||
: value;
|
||||
}
|
||||
|
||||
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||
const value = this.lookupCredential(credentialKey);
|
||||
return value
|
||||
? headers.set(headerName, (prefix ?? '') + value)
|
||||
: headers;
|
||||
}
|
||||
|
||||
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||
const value = this.lookupCredential(credentialKey);
|
||||
return value
|
||||
? query.set(paramName, value)
|
||||
: query;
|
||||
}
|
||||
|
||||
private defaultEncodeParam(param: Param): string {
|
||||
// This implementation exists as fallback for missing configuration
|
||||
// and for backwards compatibility to older typescript-angular generator versions.
|
||||
// It only works for the 'simple' parameter style.
|
||||
// Date-handling only works for the 'date-time' format.
|
||||
// All other styles and Date-formats are probably handled incorrectly.
|
||||
//
|
||||
// But: if that's all you need (i.e.: the most common use-case): no need for customization!
|
||||
|
||||
const value = param.dataFormat === 'date-time' && param.value instanceof Date
|
||||
? (param.value as Date).toISOString()
|
||||
: param.value;
|
||||
|
||||
return encodeURIComponent(String(value));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { HttpParameterCodec } from '@angular/common/http';
|
||||
|
||||
/**
|
||||
* Custom HttpParameterCodec
|
||||
* Workaround for https://github.com/angular/angular/issues/18261
|
||||
*/
|
||||
export class CustomHttpParameterCodec implements HttpParameterCodec {
|
||||
encodeKey(k: string): string {
|
||||
return encodeURIComponent(k);
|
||||
}
|
||||
encodeValue(v: string): string {
|
||||
return encodeURIComponent(v);
|
||||
}
|
||||
decodeKey(k: string): string {
|
||||
return decodeURIComponent(k);
|
||||
}
|
||||
decodeValue(v: string): string {
|
||||
return decodeURIComponent(v);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
git_host=$4
|
||||
|
||||
if [ "$git_host" = "" ]; then
|
||||
git_host="github.com"
|
||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||
fi
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="GIT_USER_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="Minor update"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=$(git remote)
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
@@ -0,0 +1,7 @@
|
||||
export * from './api/api';
|
||||
export * from './model/models';
|
||||
export * from './variables';
|
||||
export * from './configuration';
|
||||
export * from './api.module';
|
||||
export * from './provide-api';
|
||||
export * from './param';
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface Affiliation {
|
||||
/**
|
||||
* Institution name.
|
||||
*/
|
||||
institution: string;
|
||||
country_code?: string | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { ValidationError } from './validation-error';
|
||||
|
||||
|
||||
export interface HTTPValidationError {
|
||||
detail?: Array<ValidationError>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface ItemCreate {
|
||||
/**
|
||||
* The name of the item.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The description of the item.
|
||||
*/
|
||||
description: string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { Item } from './item';
|
||||
|
||||
|
||||
export interface ItemPage {
|
||||
/**
|
||||
* The elements of the page.
|
||||
*/
|
||||
elements?: Array<Item>;
|
||||
/**
|
||||
* The page offset in elements.
|
||||
*/
|
||||
offset?: number;
|
||||
/**
|
||||
* The total number of elements.
|
||||
*/
|
||||
total?: number;
|
||||
/**
|
||||
* The page size in elements.
|
||||
*/
|
||||
size?: number;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface Item {
|
||||
/**
|
||||
* The id of the entity.
|
||||
*/
|
||||
id: number;
|
||||
/**
|
||||
* The name of the item.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The description of the item.
|
||||
*/
|
||||
description: string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
export * from './affiliation';
|
||||
export * from './http-validation-error';
|
||||
export * from './item';
|
||||
export * from './item-create';
|
||||
export * from './item-page';
|
||||
export * from './person';
|
||||
export * from './person-bio';
|
||||
export * from './person-search-result';
|
||||
export * from './validation-error';
|
||||
export * from './validation-error-loc-inner';
|
||||
export * from './work-page';
|
||||
export * from './work-summary';
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface PersonBio {
|
||||
/**
|
||||
* The generated biography.
|
||||
*/
|
||||
bio: string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { Person } from './person';
|
||||
|
||||
|
||||
export interface PersonSearchResult {
|
||||
/**
|
||||
* List of found persons.
|
||||
*/
|
||||
persons?: Array<Person>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { Affiliation } from './affiliation';
|
||||
|
||||
|
||||
export interface Person {
|
||||
/**
|
||||
* The person id.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The person name.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Number of works.
|
||||
*/
|
||||
works_count: number;
|
||||
/**
|
||||
* Number of citations.
|
||||
*/
|
||||
cited_by_count: number;
|
||||
/**
|
||||
* Affiliations.
|
||||
*/
|
||||
affiliations?: Array<Affiliation>;
|
||||
/**
|
||||
* Research topics.
|
||||
*/
|
||||
topics?: Array<string>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface ValidationErrorLocInner {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { ValidationErrorLocInner } from './validation-error-loc-inner';
|
||||
|
||||
|
||||
export interface ValidationError {
|
||||
loc: Array<ValidationErrorLocInner>;
|
||||
msg: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { WorkSummary } from './work-summary';
|
||||
|
||||
|
||||
export interface WorkPage {
|
||||
/**
|
||||
* The works on this page.
|
||||
*/
|
||||
elements?: Array<WorkSummary>;
|
||||
/**
|
||||
* The current page number.
|
||||
*/
|
||||
page?: number;
|
||||
/**
|
||||
* The requested page size.
|
||||
*/
|
||||
size?: number;
|
||||
/**
|
||||
* The total number of works.
|
||||
*/
|
||||
total?: number;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* My App Service
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface WorkSummary {
|
||||
doi?: string | null;
|
||||
title?: string | null;
|
||||
type?: string | null;
|
||||
language?: string | null;
|
||||
publication_year?: number | null;
|
||||
/**
|
||||
* The number of citations.
|
||||
*/
|
||||
cited_by_count?: number;
|
||||
/**
|
||||
* The display names of the work topics.
|
||||
*/
|
||||
topics?: Array<string>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* Standard parameter styles defined by OpenAPI spec
|
||||
*/
|
||||
export type StandardParamStyle =
|
||||
| 'matrix'
|
||||
| 'label'
|
||||
| 'form'
|
||||
| 'simple'
|
||||
| 'spaceDelimited'
|
||||
| 'pipeDelimited'
|
||||
| 'deepObject'
|
||||
;
|
||||
|
||||
/**
|
||||
* The OpenAPI standard {@link StandardParamStyle}s may be extended by custom styles by the user.
|
||||
*/
|
||||
export type ParamStyle = StandardParamStyle | string;
|
||||
|
||||
/**
|
||||
* Standard parameter locations defined by OpenAPI spec
|
||||
*/
|
||||
export type ParamLocation = 'query' | 'header' | 'path' | 'cookie';
|
||||
|
||||
/**
|
||||
* Standard types as defined in <a href="https://swagger.io/specification/#data-types">OpenAPI Specification: Data Types</a>
|
||||
*/
|
||||
export type StandardDataType =
|
||||
| "integer"
|
||||
| "number"
|
||||
| "boolean"
|
||||
| "string"
|
||||
| "object"
|
||||
| "array"
|
||||
;
|
||||
|
||||
/**
|
||||
* Standard {@link DataType}s plus your own types/classes.
|
||||
*/
|
||||
export type DataType = StandardDataType | string;
|
||||
|
||||
/**
|
||||
* Standard formats as defined in <a href="https://swagger.io/specification/#data-types">OpenAPI Specification: Data Types</a>
|
||||
*/
|
||||
export type StandardDataFormat =
|
||||
| "int32"
|
||||
| "int64"
|
||||
| "float"
|
||||
| "double"
|
||||
| "byte"
|
||||
| "binary"
|
||||
| "date"
|
||||
| "date-time"
|
||||
| "password"
|
||||
;
|
||||
|
||||
export type DataFormat = StandardDataFormat | string;
|
||||
|
||||
/**
|
||||
* The parameter to encode.
|
||||
*/
|
||||
export interface Param {
|
||||
name: string;
|
||||
value: unknown;
|
||||
in: ParamLocation;
|
||||
style: ParamStyle,
|
||||
explode: boolean;
|
||||
dataType: DataType;
|
||||
dataFormat: DataFormat | undefined;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { EnvironmentProviders, makeEnvironmentProviders } from "@angular/core";
|
||||
import { Configuration, ConfigurationParameters } from './configuration';
|
||||
import { BASE_PATH } from './variables';
|
||||
|
||||
// Returns the service class providers, to be used in the [ApplicationConfig](https://angular.dev/api/core/ApplicationConfig).
|
||||
export function provideApi(configOrBasePath: string | ConfigurationParameters): EnvironmentProviders {
|
||||
return makeEnvironmentProviders([
|
||||
typeof configOrBasePath === "string"
|
||||
? { provide: BASE_PATH, useValue: configOrBasePath }
|
||||
: {
|
||||
provide: Configuration,
|
||||
useValue: new Configuration({ ...configOrBasePath }),
|
||||
},
|
||||
]);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { InjectionToken } from '@angular/core';
|
||||
|
||||
export const BASE_PATH = new InjectionToken<string>('basePath');
|
||||
export const COLLECTION_FORMATS = {
|
||||
'csv': ',',
|
||||
'tsv': ' ',
|
||||
'ssv': ' ',
|
||||
'pipes': '|'
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100svh;
|
||||
overflow: hidden;
|
||||
"
|
||||
>
|
||||
<mat-toolbar class="main">
|
||||
<div>
|
||||
<ng-content select="[indicator]"></ng-content>
|
||||
</div>
|
||||
<div style="flex: 1" class="menu">
|
||||
@if (mediaQuery.matches && (credentialService.authenticated | async)) {
|
||||
<button mat-icon-button (click)="toggle()">
|
||||
<mat-icon>menu</mat-icon>
|
||||
</button>
|
||||
} @else {
|
||||
<a
|
||||
href="/inse-webapp/"
|
||||
style="
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
font-size: 18px;
|
||||
letter-spacing: 0.03em;
|
||||
"
|
||||
>Smartguide</a
|
||||
>
|
||||
}
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: row" class="menu">
|
||||
<ng-content select="[menu]"></ng-content>
|
||||
@if (credentialService.authenticated | async) {
|
||||
<button mat-icon-button (click)="logout()" matTooltip="Abmelden">
|
||||
<mat-icon>logout</mat-icon>
|
||||
</button>
|
||||
} @else {
|
||||
<button mat-icon-button routerLink="/login" matTooltip="Anmelden">
|
||||
<mat-icon>login</mat-icon>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</mat-toolbar>
|
||||
<div class="container">
|
||||
<mat-drawer-container style="width: 100%; height: 100%">
|
||||
@if (
|
||||
(credentialService.authenticated | async) &&
|
||||
((credentialService.superadmin | async) ||
|
||||
(credentialService.universityadmin | async))
|
||||
) {
|
||||
<mat-drawer
|
||||
class="drawer"
|
||||
#drawer
|
||||
[mode]="mediaQuery.matches ? 'over' : 'side'"
|
||||
[(opened)]="sideNavOpen"
|
||||
>
|
||||
<app-menu></app-menu>
|
||||
</mat-drawer>
|
||||
}
|
||||
<mat-drawer-content>
|
||||
<ng-content></ng-content>
|
||||
</mat-drawer-content>
|
||||
</mat-drawer-container>
|
||||
</div>
|
||||
<div class="footer-container">
|
||||
<div class="footer large">© 2026 Smartguide</div>
|
||||
<div class="footer small">© 2026 Smartguide</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,69 +0,0 @@
|
||||
@use '@angular/material' as mat;
|
||||
@import '../../m3-theme.scss';
|
||||
|
||||
.footer, .footer a {
|
||||
font-size: 12px;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
text-decoration: none;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.large {
|
||||
display: block;
|
||||
}
|
||||
.small {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.container {
|
||||
height: calc(100svh - 84px);
|
||||
overflow: auto;
|
||||
background-color: #f4f6fb;
|
||||
}
|
||||
|
||||
mat-toolbar.main {
|
||||
background: linear-gradient(135deg, #1a3a6e 0%, #2259a8 60%, #4072c2 100%);
|
||||
color: white;
|
||||
@include mat.elevation(4);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.drawer {
|
||||
width: 230px;
|
||||
@include mat.elevation(3);
|
||||
border-right: 1px solid rgba(0,0,0,0.06);
|
||||
}
|
||||
|
||||
.footer-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 28px;
|
||||
background: linear-gradient(135deg, #1a3a6e 0%, #2259a8 100%);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.container {
|
||||
background-color: #1b1b1f;
|
||||
}
|
||||
mat-toolbar.main {
|
||||
background: linear-gradient(135deg, #001849 0%, #002d6e 60%, #004290 100%);
|
||||
}
|
||||
.footer-container {
|
||||
background: linear-gradient(135deg, #001849 0%, #002d6e 100%);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.large {
|
||||
display: none;
|
||||
}
|
||||
.small {
|
||||
display: block;
|
||||
}
|
||||
.container {
|
||||
height: calc(100svh - 76px);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<mat-nav-list style="width: 199px; padding: 10px">
|
||||
<div matSubheader>Navigation</div>
|
||||
<mat-list-item routerLink="/items" routerLinkActive="active">
|
||||
<mat-icon matListItemIcon>list</mat-icon>
|
||||
<div matListItemTitle>Elemente</div>
|
||||
</mat-list-item>
|
||||
<mat-list-item routerLink="/person/0">
|
||||
<mat-icon matListItemIcon>person</mat-icon>
|
||||
<div matListItemTitle>Person 0</div>
|
||||
</mat-list-item>
|
||||
</mat-nav-list>
|
||||
@@ -1,13 +0,0 @@
|
||||
@use '@angular/material' as mat;
|
||||
@import '../../m3-theme.scss';
|
||||
|
||||
.active {
|
||||
background-color: mat.get-theme-color($light-theme, primary-container);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.active {
|
||||
background-color: mat.get-theme-color($dark-theme, primary-container);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import { RouterLink, RouterLinkActive } from '@angular/router';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { CredentialService } from '../services/credential.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-menu',
|
||||
imports: [RouterLink, MatIconModule, MatListModule, RouterLinkActive],
|
||||
templateUrl: './app-menu.component.html',
|
||||
styleUrl: './app-menu.component.scss',
|
||||
standalone: true,
|
||||
})
|
||||
export class AppMenuComponent {
|
||||
|
||||
constructor(public credentialService: CredentialService) { }
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component} from '@angular/core';
|
||||
import { RouterOutlet } from '@angular/router';
|
||||
import { AppLayoutComponent } from './app-layout/app-layout.component';
|
||||
import { AppLayoutComponent } from './shared/ui/app-layout/app-layout.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
|
||||
@@ -6,24 +6,25 @@ import { provideAnimationsAsync } from '@angular/platform-browser/animations/asy
|
||||
import { provideHttpClient, withInterceptors } from '@angular/common/http';
|
||||
import locale from '@angular/common/locales/de';
|
||||
import { registerLocaleData } from '@angular/common';
|
||||
import { authenticationInterceptor } from './interceptors/authentication.interceptor';
|
||||
import { authenticationInterceptor } from './shared/interceptors/authentication.interceptor';
|
||||
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
||||
import { MatPaginatorIntl } from '@angular/material/paginator';
|
||||
import { PaginatorIntl } from './utils/paginatorIntl';
|
||||
import { PaginatorIntl } from './shared/utils/paginatorIntl';
|
||||
import { provideApi } from './api/provide-api';
|
||||
|
||||
registerLocaleData(locale);
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
{ provide: LOCALE_ID, useValue: 'de' },
|
||||
{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: {appearance: 'outline'}},
|
||||
{
|
||||
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
|
||||
useValue: { appearance: 'outline' },
|
||||
},
|
||||
{ provide: MatPaginatorIntl, useClass: PaginatorIntl },
|
||||
provideRouter(routes),
|
||||
provideHttpClient(withInterceptors([authenticationInterceptor])),
|
||||
provideApi('/inse-service'),
|
||||
provideAnimationsAsync(),
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
import { Routes } from '@angular/router';
|
||||
import { userGuard } from './guards/user.guard';
|
||||
import { userGuard } from './shared/guards/user.guard';
|
||||
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: 'login',
|
||||
loadComponent: () =>
|
||||
import('./app-login/app-login.component').then(
|
||||
import('./modules/app-login/app-login.component').then(
|
||||
(mod) => mod.AppLoginComponent,
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'items',
|
||||
path: 'dashboard',
|
||||
canActivate: [userGuard],
|
||||
loadComponent: () =>
|
||||
import('./list-item/list-item.component').then(
|
||||
(mod) => mod.ListItemComponent,
|
||||
import('./modules/dashboard/dashboard.component').then(
|
||||
(mod) => mod.DashboardComponent,
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'person/:id',
|
||||
canActivate: [userGuard],
|
||||
loadComponent: () =>
|
||||
import('./person/person.component').then((mod) => mod.PersonComponent),
|
||||
import('./modules/person/person.component').then(
|
||||
(mod) => mod.PersonComponent,
|
||||
),
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
@@ -31,17 +33,24 @@ export const routes: Routes = [
|
||||
{
|
||||
path: 'overview',
|
||||
loadComponent: () =>
|
||||
import('./person-overview/person-overview.component').then(
|
||||
import('./modules/person-overview/person-overview.component').then(
|
||||
(mod) => mod.PersonOverviewComponent,
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'network',
|
||||
loadComponent: () =>
|
||||
import('./person-network/person-network.component').then(
|
||||
import('./modules/person-network/person-network.component').then(
|
||||
(mod) => mod.PersonNetworkComponent,
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'publications',
|
||||
loadComponent: () =>
|
||||
import('./modules/person-publications/person-publications.component').then(
|
||||
(mod) => mod.PersonPublicationsComponent,
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
<div class="page">
|
||||
<div class="form-section">
|
||||
<h3>{{ editing ? 'Element bearbeiten' : 'Neues Element' }}</h3>
|
||||
<form [formGroup]="itemForm" class="item-form">
|
||||
<mat-form-field>
|
||||
<mat-label>Name</mat-label>
|
||||
<input matInput formControlName="name">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label>Beschreibung</mat-label>
|
||||
<input matInput formControlName="description">
|
||||
</mat-form-field>
|
||||
<div class="form-actions">
|
||||
<button mat-flat-button class="primary-button" (click)="save()" [disabled]="!itemForm.valid">
|
||||
{{ editing ? 'Speichern' : 'Erstellen' }}
|
||||
</button>
|
||||
@if (editing) {
|
||||
<button mat-flat-button class="secondary-button" (click)="cancelEdit()">Abbrechen</button>
|
||||
}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<table mat-table [dataSource]="items" class="mat-elevation-z2">
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef>ID</th>
|
||||
<td mat-cell *matCellDef="let item">{{ item.id }}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef>Name</th>
|
||||
<td mat-cell *matCellDef="let item">{{ item.name }}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="description">
|
||||
<th mat-header-cell *matHeaderCellDef>Beschreibung</th>
|
||||
<td mat-cell *matCellDef="let item">{{ item.description }}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let item">
|
||||
<button mat-icon-button (click)="startEdit(item)" matTooltip="Bearbeiten">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
<button mat-icon-button (click)="delete(item)" matTooltip="Löschen">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
|
||||
<mat-paginator
|
||||
[length]="total"
|
||||
[pageSize]="paginationService.selection"
|
||||
[pageSizeOptions]="paginationService.options"
|
||||
(page)="onPage($event)">
|
||||
</mat-paginator>
|
||||
</div>
|
||||
@@ -1,73 +0,0 @@
|
||||
.page {
|
||||
padding: 28px 32px;
|
||||
max-width: 960px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.form-section {
|
||||
margin-bottom: 24px;
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 24px;
|
||||
box-shadow: 0 1px 6px rgba(26, 58, 110, 0.08);
|
||||
}
|
||||
|
||||
.form-section h3 {
|
||||
margin: 0 0 16px;
|
||||
font-weight: 600;
|
||||
color: #1a3a6e;
|
||||
}
|
||||
|
||||
.item-form {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: baseline;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.form-actions button {
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
::ng-deep .mat-mdc-header-row {
|
||||
background-color: #eaf0ff;
|
||||
}
|
||||
|
||||
mat-paginator {
|
||||
margin-top: 8px;
|
||||
border-radius: 0 0 12px 12px;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.form-section {
|
||||
background: #303034;
|
||||
box-shadow: 0 1px 6px rgba(0,0,0,0.2);
|
||||
}
|
||||
.form-section h3 {
|
||||
color: #a4c4ff;
|
||||
}
|
||||
::ng-deep .mat-mdc-header-row {
|
||||
background-color: #1b1b22;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.page {
|
||||
padding: 16px;
|
||||
}
|
||||
.item-form {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatPaginator, MatPaginatorModule, PageEvent } from '@angular/material/paginator';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||
import { ApiService, Item } from '../services/api.service';
|
||||
import { PaginationService } from '../services/pagination.service';
|
||||
import { ConfirmationDialogComponent } from '../confirmation-dialog/confirmation-dialog.component';
|
||||
import { createLoadError } from '../utils/errorHandler';
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-item',
|
||||
imports: [
|
||||
MatTableModule,
|
||||
MatPaginatorModule,
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
MatDialogModule,
|
||||
MatSnackBarModule,
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
ReactiveFormsModule
|
||||
],
|
||||
templateUrl: './list-item.component.html',
|
||||
styleUrl: './list-item.component.scss',
|
||||
standalone: true,
|
||||
})
|
||||
export class ListItemComponent implements OnInit {
|
||||
|
||||
displayedColumns: string[] = ['id', 'name', 'description', 'actions'];
|
||||
items: Item[] = [];
|
||||
total = 0;
|
||||
editing: Item | null = null;
|
||||
|
||||
itemForm = new FormGroup({
|
||||
name: new FormControl<string>('', [Validators.required, Validators.maxLength(200)]),
|
||||
description: new FormControl<string>('', [Validators.maxLength(2000)])
|
||||
});
|
||||
|
||||
constructor(
|
||||
public apiService: ApiService,
|
||||
public paginationService: PaginationService,
|
||||
private dialog: MatDialog,
|
||||
private snackBar: MatSnackBar
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.load();
|
||||
}
|
||||
|
||||
load() {
|
||||
const offset = 0;
|
||||
this.apiService.getItems(offset, this.paginationService.selection).subscribe({
|
||||
next: (page) => {
|
||||
this.items = page.elements;
|
||||
this.total = page.total;
|
||||
},
|
||||
error: createLoadError(this.snackBar, () => this.load())
|
||||
});
|
||||
}
|
||||
|
||||
onPage(event: PageEvent) {
|
||||
this.paginationService.selection = event.pageSize;
|
||||
const offset = event.pageIndex * event.pageSize;
|
||||
this.apiService.getItems(offset, event.pageSize).subscribe({
|
||||
next: (page) => {
|
||||
this.items = page.elements;
|
||||
this.total = page.total;
|
||||
},
|
||||
error: createLoadError(this.snackBar, () => this.onPage(event))
|
||||
});
|
||||
}
|
||||
|
||||
startEdit(item: Item) {
|
||||
this.editing = item;
|
||||
this.itemForm.patchValue({ name: item.name, description: item.description });
|
||||
}
|
||||
|
||||
cancelEdit() {
|
||||
this.editing = null;
|
||||
this.itemForm.reset();
|
||||
}
|
||||
|
||||
save() {
|
||||
if (!this.itemForm.valid) return;
|
||||
const data = { name: this.itemForm.value.name!, description: this.itemForm.value.description ?? '' };
|
||||
if (this.editing) {
|
||||
this.apiService.updateItem(this.editing.id, data).subscribe({
|
||||
next: () => { this.cancelEdit(); this.load(); },
|
||||
error: createLoadError(this.snackBar)
|
||||
});
|
||||
} else {
|
||||
this.apiService.createItem(data).subscribe({
|
||||
next: () => { this.cancelEdit(); this.load(); },
|
||||
error: createLoadError(this.snackBar)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
delete(item: Item) {
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent);
|
||||
dialogRef.componentInstance.confirmDelete.subscribe(() => {
|
||||
this.apiService.deleteItem(item.id).subscribe({
|
||||
next: () => this.load(),
|
||||
error: createLoadError(this.snackBar)
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
-17
@@ -50,20 +50,3 @@
|
||||
.error {
|
||||
color: #ba1a1a;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.container {
|
||||
background: linear-gradient(160deg, #1b1b1f 0%, #252530 100%);
|
||||
}
|
||||
.form {
|
||||
background: #303034;
|
||||
box-shadow: 0 2px 12px rgba(0,0,0,0.3);
|
||||
}
|
||||
.form h3 {
|
||||
color: #a4c4ff;
|
||||
}
|
||||
.progress {
|
||||
color: #c1c8dc;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angula
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { CredentialService } from '../services/credential.service';
|
||||
import { CredentialService } from '../../shared/services/credential.service';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Subscription } from 'rxjs';
|
||||
@@ -46,7 +46,7 @@ export class AppLoginComponent implements OnInit, OnDestroy {
|
||||
|
||||
checkEnter(): void {
|
||||
if (this.credentialService.authenticated.value) {
|
||||
this.router.navigate(['/items']);
|
||||
this.router.navigate(['/dashboard']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dashboard',
|
||||
imports: [],
|
||||
templateUrl: './dashboard.component.html',
|
||||
styleUrl: './dashboard.component.scss',
|
||||
standalone: true,
|
||||
})
|
||||
export class DashboardComponent {}
|
||||
@@ -0,0 +1,103 @@
|
||||
<div class="page">
|
||||
<div class="section-heading">
|
||||
<div>
|
||||
<h6>Publikationen</h6>
|
||||
<p>Übersicht der wissenschaftlichen Veröffentlichungen.</p>
|
||||
</div>
|
||||
<div class="table-actions">
|
||||
<button mat-stroked-button>
|
||||
<mat-icon>filter_alt</mat-icon>
|
||||
Filter
|
||||
</button>
|
||||
<button mat-stroked-button>
|
||||
<mat-icon>sort</mat-icon>
|
||||
Sortieren nach: Neueste
|
||||
<mat-icon>keyboard_arrow_down</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-wrap">
|
||||
@if (loading) {
|
||||
<div class="loading">
|
||||
<mat-spinner diameter="36"></mat-spinner>
|
||||
</div>
|
||||
}
|
||||
|
||||
<table mat-table [dataSource]="publications" class="mat-elevation-z2">
|
||||
<ng-container matColumnDef="title">
|
||||
<th mat-header-cell *matHeaderCellDef>Titel</th>
|
||||
<td mat-cell *matCellDef="let publication">
|
||||
@if (doiUrl(publication.doi); as url) {
|
||||
<a class="title" [href]="url" target="_blank" rel="noopener">
|
||||
{{ publication.title || 'Ohne Titel' }}
|
||||
</a>
|
||||
} @else {
|
||||
<div class="title">{{ publication.title || 'Ohne Titel' }}</div>
|
||||
}
|
||||
<div class="authors">Becker, A.; Müller, T.; Zhang, L.</div>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="year">
|
||||
<th mat-header-cell *matHeaderCellDef>Jahr</th>
|
||||
<td mat-cell *matCellDef="let publication">{{ publication.publication_year || '-' }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="type">
|
||||
<th mat-header-cell *matHeaderCellDef>Typ</th>
|
||||
<td mat-cell *matCellDef="let publication">
|
||||
@if (publication.type) {
|
||||
<app-chip [color]="typeColor(publication.type)">
|
||||
{{ publication.type }}
|
||||
</app-chip>
|
||||
} @else {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="language">
|
||||
<th mat-header-cell *matHeaderCellDef>Sprache / Quelle</th>
|
||||
<td mat-cell *matCellDef="let publication">{{ publication.language || '-' }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="citations">
|
||||
<th mat-header-cell *matHeaderCellDef>Zitationen</th>
|
||||
<td mat-cell *matCellDef="let publication">{{ publication.cited_by_count ?? 0 }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="topics">
|
||||
<th mat-header-cell *matHeaderCellDef>Themen</th>
|
||||
<td mat-cell *matCellDef="let publication">
|
||||
<div class="topic-chips" aria-label="Themen">
|
||||
@for (topic of (publication.topics ?? []).slice(0, 3); track topic) {
|
||||
<app-chip variant="outlined" color="primary">
|
||||
{{ topic }}
|
||||
</app-chip>
|
||||
} @empty {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
|
||||
@if (!loading && publications.length === 0) {
|
||||
<div class="empty-state">Keine Publikationen gefunden.</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="table-footer">
|
||||
<span>{{ publicationRange() }}</span>
|
||||
<mat-paginator
|
||||
[length]="total"
|
||||
[pageSize]="paginationService.selection"
|
||||
[pageSizeOptions]="paginationService.options"
|
||||
(page)="onPage($event)">
|
||||
</mat-paginator>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,152 @@
|
||||
.page {
|
||||
padding: 28px 32px 42px;
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.section-heading {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 0 0 6px;
|
||||
font-size: 22px;
|
||||
line-height: 1.2;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.section-heading p {
|
||||
margin: 0;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.table-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.table-actions button {
|
||||
height: 42px;
|
||||
border-color: var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
color: var(--sg-text);
|
||||
}
|
||||
|
||||
.table-wrap {
|
||||
position: relative;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
min-width: 980px;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0 10px;
|
||||
overflow: hidden;
|
||||
box-shadow: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: inline-block;
|
||||
max-width: 520px;
|
||||
line-height: 1.35;
|
||||
color: var(--sg-text);
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.title:hover {
|
||||
color: var(--sg-text);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.authors {
|
||||
margin-top: 7px;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.loading {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 1;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: rgba(255, 255, 255, 0.65);
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
padding: 28px;
|
||||
text-align: center;
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
color: rgba(0, 0, 0, 0.54);
|
||||
}
|
||||
|
||||
.topic-chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
max-width: 320px;
|
||||
}
|
||||
|
||||
::ng-deep .mat-mdc-header-cell {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
::ng-deep .mat-mdc-row {
|
||||
height: 86px;
|
||||
}
|
||||
|
||||
::ng-deep .mat-mdc-cell {
|
||||
color: var(--sg-text);
|
||||
border-bottom-color: var(--sg-border);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
mat-paginator {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.table-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 66px;
|
||||
padding: 0 22px 0 28px;
|
||||
border: 0;
|
||||
border-top: 0;
|
||||
border-radius: 0;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.page {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.section-heading,
|
||||
.table-footer {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.table-actions {
|
||||
justify-content: stretch;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
|
||||
import { WorkSummary } from '../../api';
|
||||
import { PublicationsService } from '../../shared/services/publications.service';
|
||||
import { PaginationService } from '../../shared/services/pagination.service';
|
||||
import { createLoadError } from '../../shared/utils/errorHandler';
|
||||
import { ChipComponent } from '../../shared/ui/chip/chip.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-person-publications',
|
||||
imports: [
|
||||
MatButtonModule,
|
||||
ChipComponent,
|
||||
MatIconModule,
|
||||
MatPaginatorModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatSnackBarModule,
|
||||
MatTableModule,
|
||||
],
|
||||
templateUrl: './person-publications.component.html',
|
||||
styleUrl: './person-publications.component.scss',
|
||||
})
|
||||
export class PersonPublicationsComponent implements OnInit {
|
||||
displayedColumns: string[] = [
|
||||
'title',
|
||||
'type',
|
||||
'year',
|
||||
'language',
|
||||
'topics',
|
||||
'citations',
|
||||
];
|
||||
publications: WorkSummary[] = [];
|
||||
total = 0;
|
||||
loading = false;
|
||||
authorId = '';
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private publicationsService: PublicationsService,
|
||||
public paginationService: PaginationService,
|
||||
private snackBar: MatSnackBar,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.route.parent?.paramMap.subscribe((params) => {
|
||||
this.authorId = params.get('id') ?? '';
|
||||
this.load();
|
||||
});
|
||||
}
|
||||
|
||||
load(pageIndex = 0, pageSize = this.paginationService.selection): void {
|
||||
if (!this.authorId) return;
|
||||
|
||||
this.loading = true;
|
||||
this.publicationsService
|
||||
.getAuthorWorks(this.authorId, pageIndex + 1, pageSize)
|
||||
.subscribe({
|
||||
next: (page) => {
|
||||
this.publications = page.elements ?? [];
|
||||
this.total = page.total ?? 0;
|
||||
this.loading = false;
|
||||
},
|
||||
error: (error) => {
|
||||
this.loading = false;
|
||||
createLoadError(
|
||||
this.snackBar,
|
||||
() => this.load(pageIndex, pageSize),
|
||||
'Publikationen konnten nicht geladen werden',
|
||||
)(error);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
onPage(event: PageEvent): void {
|
||||
this.paginationService.selection = event.pageSize;
|
||||
this.load(event.pageIndex, event.pageSize);
|
||||
}
|
||||
|
||||
doiUrl(doi: string | null | undefined): string | null {
|
||||
if (!doi) return null;
|
||||
return doi.startsWith('http') ? doi : `https://doi.org/${doi}`;
|
||||
}
|
||||
|
||||
publicationRange(): string {
|
||||
if (this.total === 0 || this.publications.length === 0) {
|
||||
return 'Keine Publikationen';
|
||||
}
|
||||
|
||||
return `Zeige 1 bis ${this.publications.length} von ${this.total} Publikationen`;
|
||||
}
|
||||
|
||||
typeColor(type: string | null | undefined): string {
|
||||
const normalized = (type ?? '').toLowerCase();
|
||||
if (normalized.includes('conference')) return 'success';
|
||||
if (normalized.includes('book')) return 'help';
|
||||
return 'info';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<section class="person-hero">
|
||||
<div class="profile-card">
|
||||
<div class="profile-avatar">AB</div>
|
||||
<div class="profile-main">
|
||||
<div class="name-line">
|
||||
<span>Prof. Dr.</span>
|
||||
<h1>Anna Becker</h1>
|
||||
</div>
|
||||
<p>Universität Duisburg-Essen</p>
|
||||
<span>Fakultät für Ingenieurwissenschaften</span>
|
||||
<span>Lehrstuhl für Datenanalyse</span>
|
||||
</div>
|
||||
<div class="profile-contact">
|
||||
<div>
|
||||
<mat-icon>mail</mat-icon>
|
||||
<span>anna.becker@uni-due.de</span>
|
||||
</div>
|
||||
<div>
|
||||
<mat-icon class="orcid">verified</mat-icon>
|
||||
<span>0000-0002-1234-5678</span>
|
||||
</div>
|
||||
<div>
|
||||
<mat-icon>language</mat-icon>
|
||||
<a href="https://ude.de/anna-becker" target="_blank" rel="noopener">ude.de/anna-becker</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<aside class="interest-card">
|
||||
<h3>Interessant für</h3>
|
||||
<div class="interest-tags">
|
||||
<span>KI & Machine Learning</span>
|
||||
<span>Datenanalyse</span>
|
||||
<span>Industrie 4.0</span>
|
||||
<span>Nachhaltigkeit</span>
|
||||
<span>Smart Systems</span>
|
||||
</div>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
<nav class="person-tabs" mat-tab-nav-bar [tabPanel]="tabPanel">
|
||||
@for (link of links; track link.path) {
|
||||
<a
|
||||
mat-tab-link
|
||||
[routerLink]="link.path"
|
||||
routerLinkActive
|
||||
#rla="routerLinkActive"
|
||||
[active]="rla.isActive"
|
||||
[disabled]="link.disabled"
|
||||
>
|
||||
{{ link.label }}
|
||||
</a>
|
||||
}
|
||||
</nav>
|
||||
<mat-tab-nav-panel #tabPanel class="person-panel">
|
||||
<router-outlet></router-outlet>
|
||||
</mat-tab-nav-panel>
|
||||
@@ -0,0 +1,191 @@
|
||||
.person-hero {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(320px, 500px);
|
||||
gap: 40px;
|
||||
padding: 28px 32px 24px;
|
||||
border-bottom: 1px solid var(--sg-border);
|
||||
background: var(--sg-background);
|
||||
}
|
||||
|
||||
.profile-card {
|
||||
display: grid;
|
||||
grid-template-columns: 112px minmax(240px, 1fr) minmax(260px, 360px);
|
||||
gap: 36px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.profile-avatar {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 112px;
|
||||
height: 112px;
|
||||
border-radius: 50%;
|
||||
background:
|
||||
radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.78), transparent 34%),
|
||||
linear-gradient(145deg, #c8d9ff, #f7faff 48%, #88a9ee);
|
||||
border: 1px solid var(--sg-border);
|
||||
box-shadow: var(--sg-shadow-sm);
|
||||
color: var(--sg-primary);
|
||||
font-family: 'Montserrat', 'Open Sans', Arial, sans-serif;
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.profile-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.name-line {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.name-line span {
|
||||
color: var(--sg-text);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.name-line h1 {
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
line-height: 1.15;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.profile-main p {
|
||||
margin: 10px 0 0;
|
||||
color: var(--sg-text);
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.profile-main > span {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.profile-contact {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
color: var(--sg-text);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.profile-contact div {
|
||||
display: grid;
|
||||
grid-template-columns: 24px 1fr;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.profile-contact mat-icon {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 20px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.profile-contact .orcid {
|
||||
color: #6cc24a;
|
||||
}
|
||||
|
||||
.profile-contact a {
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.interest-card {
|
||||
align-self: center;
|
||||
padding: 24px 28px;
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: var(--sg-surface-muted);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
|
||||
.interest-card h3 {
|
||||
margin: 0 0 18px;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.interest-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.interest-tags span {
|
||||
padding: 9px 16px;
|
||||
border: 1px solid #a8c0ff;
|
||||
border-radius: 7px;
|
||||
background: #ffffff;
|
||||
color: var(--sg-primary);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.person-tabs {
|
||||
padding: 0 32px;
|
||||
border-bottom: 1px solid var(--sg-border);
|
||||
background: var(--sg-background);
|
||||
}
|
||||
|
||||
.person-tabs a {
|
||||
min-width: 132px;
|
||||
height: 58px;
|
||||
color: var(--sg-text);
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.person-tabs a.mdc-tab--active {
|
||||
color: var(--sg-primary);
|
||||
}
|
||||
|
||||
::ng-deep .person-tabs .mdc-tab-indicator__content--underline {
|
||||
border-color: var(--sg-primary);
|
||||
border-top-width: 3px;
|
||||
}
|
||||
|
||||
.person-panel {
|
||||
display: block;
|
||||
background: var(--sg-background);
|
||||
}
|
||||
|
||||
@media (max-width: 1180px) {
|
||||
.person-hero {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.profile-card {
|
||||
grid-template-columns: 112px 1fr;
|
||||
}
|
||||
|
||||
.profile-contact {
|
||||
grid-column: 2;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.person-hero {
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.profile-card {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.profile-contact {
|
||||
grid-column: auto;
|
||||
}
|
||||
|
||||
.person-tabs {
|
||||
padding: 0 16px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -1,10 +1,11 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { RouterModule, RouterOutlet } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-person',
|
||||
imports: [MatTabsModule, RouterOutlet, RouterModule],
|
||||
imports: [MatIconModule, MatTabsModule, RouterOutlet, RouterModule],
|
||||
templateUrl: './person.component.html',
|
||||
styleUrl: './person.component.scss',
|
||||
})
|
||||
@@ -12,7 +13,7 @@ export class PersonComponent {
|
||||
links = [
|
||||
{ label: 'Übersicht', path: 'overview', disabled: false },
|
||||
{ label: 'Projekte', path: 'projects', disabled: true },
|
||||
{ label: 'Publikationen', path: 'publications', disabled: true },
|
||||
{ label: 'Publikationen', path: 'publications', disabled: false },
|
||||
{ label: 'Netzwerk', path: 'network', disabled: false },
|
||||
{ label: 'Gründungen', path: 'foundings', disabled: true },
|
||||
];
|
||||
@@ -1,18 +0,0 @@
|
||||
<p>person works!</p>
|
||||
<nav mat-tab-nav-bar [tabPanel]="tabPanel">
|
||||
@for (link of links; track $index) {
|
||||
<a
|
||||
mat-tab-link
|
||||
[routerLink]="link.path"
|
||||
routerLinkActive
|
||||
#rla="routerLinkActive"
|
||||
[active]="rla.isActive"
|
||||
[disabled]="link.disabled"
|
||||
>
|
||||
{{ link.label }}
|
||||
</a>
|
||||
}
|
||||
</nav>
|
||||
<mat-tab-nav-panel #tabPanel></mat-tab-nav-panel>
|
||||
|
||||
<router-outlet></router-outlet>
|
||||
@@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { WorkPage, WorksOpenApiService } from '../../api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class PublicationsService {
|
||||
constructor(private worksApi: WorksOpenApiService) {}
|
||||
|
||||
getAuthorWorks(
|
||||
authorId: string,
|
||||
page: number = 1,
|
||||
size: number = 10,
|
||||
): Observable<WorkPage> {
|
||||
return this.worksApi.getAuthorWorks(authorId, page, size);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<div class="app-shell">
|
||||
<div class="container">
|
||||
<mat-drawer-container class="drawer-container">
|
||||
@if (
|
||||
(credentialService.authenticated | async) &&
|
||||
((credentialService.superadmin | async) ||
|
||||
(credentialService.universityadmin | async))
|
||||
) {
|
||||
<mat-drawer
|
||||
class="drawer"
|
||||
#drawer
|
||||
[mode]="mediaQuery.matches ? 'over' : 'side'"
|
||||
[(opened)]="sideNavOpen"
|
||||
>
|
||||
<app-menu></app-menu>
|
||||
</mat-drawer>
|
||||
}
|
||||
<mat-drawer-content class="content-shell">
|
||||
<mat-toolbar class="main">
|
||||
<div class="topbar-left">
|
||||
@if (
|
||||
mediaQuery.matches && (credentialService.authenticated | async)
|
||||
) {
|
||||
<button
|
||||
mat-icon-button
|
||||
(click)="toggle()"
|
||||
matTooltip="Navigation"
|
||||
>
|
||||
<mat-icon>menu</mat-icon>
|
||||
</button>
|
||||
}
|
||||
<button class="back-link" type="button">
|
||||
<mat-icon>arrow_back</mat-icon>
|
||||
<span>Zurück zur Suche</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<label class="search-box">
|
||||
<mat-icon>search</mat-icon>
|
||||
<input
|
||||
type="search"
|
||||
placeholder="Suchen nach Personen, Themen, Projekten..."
|
||||
/>
|
||||
</label>
|
||||
|
||||
<div class="topbar-actions">
|
||||
<ng-content select="[menu]"></ng-content>
|
||||
</div>
|
||||
</mat-toolbar>
|
||||
|
||||
<main class="content">
|
||||
<ng-content></ng-content>
|
||||
</main>
|
||||
</mat-drawer-content>
|
||||
</mat-drawer-container>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,146 @@
|
||||
@use '@angular/material' as mat;
|
||||
@import '../../../../m3-theme.scss';
|
||||
|
||||
.app-shell {
|
||||
height: 100svh;
|
||||
overflow: hidden;
|
||||
background: var(--sg-background);
|
||||
}
|
||||
|
||||
.container,
|
||||
.drawer-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: var(--sg-background);
|
||||
}
|
||||
|
||||
.container {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.content-shell {
|
||||
min-height: 100%;
|
||||
background: var(--sg-background);
|
||||
}
|
||||
|
||||
mat-toolbar.main {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(190px, 1fr) minmax(320px, 560px) minmax(130px, 1fr);
|
||||
gap: 24px;
|
||||
height: 76px;
|
||||
padding: 0 32px;
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
border-bottom: 1px solid var(--sg-border);
|
||||
color: var(--sg-text);
|
||||
backdrop-filter: blur(16px);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.topbar-left,
|
||||
.topbar-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.topbar-actions {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.topbar-actions button {
|
||||
color: var(--sg-text);
|
||||
}
|
||||
|
||||
.back-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
min-height: 42px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.back-link mat-icon {
|
||||
font-size: 20px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.search-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
height: 44px;
|
||||
align-self: center;
|
||||
padding: 0 18px;
|
||||
background: var(--sg-surface-muted);
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
color: var(--sg-text-soft);
|
||||
font-size: 13px;
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
|
||||
.search-box input {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
background: transparent;
|
||||
color: var(--sg-text);
|
||||
}
|
||||
|
||||
.search-box input::placeholder {
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
.drawer {
|
||||
width: var(--sg-sidebar-width);
|
||||
background: var(--sg-surface);
|
||||
border-right: 1px solid var(--sg-border);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.content {
|
||||
min-height: calc(100svh - 76px);
|
||||
background: var(--sg-background);
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
mat-toolbar.main {
|
||||
grid-template-columns: auto 1fr auto;
|
||||
height: auto;
|
||||
min-height: 72px;
|
||||
padding: 12px 16px;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.back-link span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.search-box {
|
||||
height: 44px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
mat-toolbar.main {
|
||||
grid-template-columns: 1fr auto;
|
||||
}
|
||||
|
||||
.search-box {
|
||||
grid-column: 1 / -1;
|
||||
order: 3;
|
||||
}
|
||||
|
||||
.content {
|
||||
min-height: calc(100svh - 124px);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ import { Router, RouterLink } from '@angular/router';
|
||||
import { MediaMatcher } from '@angular/cdk/layout';
|
||||
import { AppMenuComponent } from '../app-menu/app-menu.component';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { CredentialService } from '../services/credential.service';
|
||||
import { CredentialService } from '../../services/credential.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-layout',
|
||||
@@ -0,0 +1,54 @@
|
||||
<aside class="sidebar">
|
||||
<a class="brand" routerLink="/items" aria-label="Smartguide Startseite">
|
||||
<span class="brand-mark">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</span>
|
||||
<span class="brand-text">
|
||||
<strong>AIIS</strong>
|
||||
<small>AI Innovation<br />Intelligence System</small>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<mat-nav-list class="nav-list">
|
||||
@for (item of navItems; track item.label) {
|
||||
<a
|
||||
mat-list-item
|
||||
[routerLink]="item.disabled ? null : item.route"
|
||||
routerLinkActive="active"
|
||||
[class.disabled]="item.disabled"
|
||||
>
|
||||
<mat-icon matListItemIcon>{{ item.icon }}</mat-icon>
|
||||
<span matListItemTitle>{{ item.label }}</span>
|
||||
</a>
|
||||
}
|
||||
</mat-nav-list>
|
||||
|
||||
<div class="sidebar-spacer"></div>
|
||||
|
||||
<div class="account-card">
|
||||
<div class="avatar">M</div>
|
||||
<div>
|
||||
<strong>{{
|
||||
(credentialService.login | async) || "Max Mustermann"
|
||||
}}</strong>
|
||||
<span>Startup Coach</span>
|
||||
</div>
|
||||
<mat-icon>expand_more</mat-icon>
|
||||
</div>
|
||||
|
||||
<div class="sidebar-actions">
|
||||
<button
|
||||
class="utility-link"
|
||||
type="button"
|
||||
(click)="credentialService.logoutAcount()"
|
||||
>
|
||||
<mat-icon>logout</mat-icon>
|
||||
<span>Abmelden</span>
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
@@ -0,0 +1,182 @@
|
||||
@use '@angular/material' as mat;
|
||||
@import '../../../../m3-theme.scss';
|
||||
|
||||
.sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
padding: 28px 16px 22px;
|
||||
color: var(--sg-text);
|
||||
}
|
||||
|
||||
.brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
min-height: 58px;
|
||||
padding: 0 12px;
|
||||
color: var(--sg-text);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.brand-mark {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
}
|
||||
|
||||
.brand-mark::before,
|
||||
.brand-mark::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 10px 8px;
|
||||
border: 2px solid rgba(0, 87, 255, 0.22);
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.brand-mark::after {
|
||||
transform: rotate(60deg);
|
||||
}
|
||||
|
||||
.brand-mark span {
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background: var(--sg-primary);
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.brand-mark span:nth-child(1) { left: 16px; top: 0; }
|
||||
.brand-mark span:nth-child(2) { right: 0; top: 9px; }
|
||||
.brand-mark span:nth-child(3) { right: 0; bottom: 9px; }
|
||||
.brand-mark span:nth-child(4) { left: 16px; bottom: 0; }
|
||||
.brand-mark span:nth-child(5) { left: 0; bottom: 9px; }
|
||||
.brand-mark span:nth-child(6) { left: 0; top: 9px; }
|
||||
|
||||
.brand-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.brand-text strong {
|
||||
font-family: 'Montserrat', 'Open Sans', Arial, sans-serif;
|
||||
font-size: 24px;
|
||||
line-height: 1;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.brand-text small {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 11px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.nav-list {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
margin-top: 42px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.nav-list a {
|
||||
height: 46px;
|
||||
border-radius: var(--sg-radius-sm);
|
||||
color: var(--sg-text);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.nav-list a.active {
|
||||
background: var(--sg-primary-soft);
|
||||
color: var(--sg-primary);
|
||||
}
|
||||
|
||||
.nav-list a.disabled {
|
||||
opacity: 0.72;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.nav-list mat-icon,
|
||||
.utility-link mat-icon {
|
||||
color: var(--sg-text-soft);
|
||||
}
|
||||
|
||||
.nav-list a.active mat-icon {
|
||||
color: var(--sg-primary);
|
||||
}
|
||||
|
||||
.sidebar-spacer {
|
||||
flex: 1;
|
||||
min-height: 28px;
|
||||
}
|
||||
|
||||
.account-card {
|
||||
display: grid;
|
||||
grid-template-columns: 40px 1fr 20px;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
min-height: 68px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: var(--sg-surface);
|
||||
}
|
||||
|
||||
.account-card .avatar {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(135deg, #dce8ff, #ffffff);
|
||||
color: var(--sg-primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.account-card strong,
|
||||
.account-card span {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.account-card strong {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.account-card span {
|
||||
margin-top: 2px;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.account-card mat-icon {
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
.sidebar-actions {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
margin-top: 26px;
|
||||
}
|
||||
|
||||
.utility-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 18px;
|
||||
height: 40px;
|
||||
width: 100%;
|
||||
padding: 0 12px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
border-radius: var(--sg-radius-sm);
|
||||
color: var(--sg-text);
|
||||
text-align: left;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.utility-link:hover {
|
||||
background: var(--sg-surface-muted);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterLink, RouterLinkActive } from '@angular/router';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { CredentialService } from '../../services/credential.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-menu',
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterLink,
|
||||
MatIconModule,
|
||||
MatListModule,
|
||||
RouterLinkActive,
|
||||
],
|
||||
templateUrl: './app-menu.component.html',
|
||||
styleUrl: './app-menu.component.scss',
|
||||
standalone: true,
|
||||
})
|
||||
export class AppMenuComponent {
|
||||
navItems = [
|
||||
{ label: 'Dashboard', icon: 'dashboard', route: '/items', disabled: false },
|
||||
{ label: 'Personen', icon: 'groups', route: '/person/0', disabled: false },
|
||||
];
|
||||
|
||||
constructor(public credentialService: CredentialService) {}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<ng-content></ng-content>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user