-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#38] updating with develop and making pydantic v2 specific code changes
- Loading branch information
Showing
112 changed files
with
20,015 additions
and
24,819 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" # See documentation for possible values | ||
directory: "/frontend" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,18 +11,17 @@ env: | |
IP: iguide-dev | ||
TESTING: false | ||
OIDC_ISSUER: https://orcid.org | ||
DATABASE_NAME: iguide_beta | ||
DATABASE_NAME: iguide_dev | ||
DB_PROTOCOL: mongodb+srv | ||
HYDROSHARE_META_READ_URL: https://www.hydroshare.org/hsapi2/resource/%s/json/ | ||
HYDROSHARE_FILE_READ_URL: https://www.hydroshare.org/hsapi/resource/%s/files/ | ||
VUE_APP_NAME: CZNet Discovery | ||
VUE_APP_LOGIN_URL: https://orcid.org/oauth/authorize | ||
VUE_APP_API_URL: api | ||
VUE_APP_HEAP_ANALYTICS_APP_ID: "" | ||
VUE_APP_GOOGLE_MAPS_API_KEY: "" | ||
VUE_APP_SUPPORT_EMAIL: [email protected] | ||
VUE_APP_REALM_APP_ID: data-axdrs | ||
VUE_APP_SEARCH_RESOLVER: filtering_cznet | ||
VITE_APP_NAME: I-GUIDE | ||
VITE_APP_URL: https://iguide-dev.cuahsi.io | ||
VITE_APP_API_URL: https://iguide-dev.cuahsi.io/api | ||
VITE_APP_LOGIN_URL: https://orcid.org/oauth/authorize | ||
VITE_APP_SUPPORT_EMAIL: [email protected] | ||
VITE_APP_CLIENT_ID: APP-4ZA8C8BYAH3QHNE9 | ||
SEARCH_RELEVANCE_SCORE_THRESHOLD: 1.4 | ||
|
||
|
||
jobs: | ||
|
@@ -46,7 +45,7 @@ jobs: | |
DB_USERNAME: ${{ secrets.DB_USERNAME_BETA }} | ||
DB_PASSWORD: ${{ secrets.DB_PASSWORD_BETA }} | ||
run: | | ||
variables=("OIDC_ISSUER" "DB_USERNAME" "DB_PASSWORD" "DB_HOST" "DATABASE_NAME" "DB_PROTOCOL" "TESTING" "VUE_APP_LOGIN_URL" "HYDROSHARE_META_READ_URL" "HYDROSHARE_FILE_READ_URL") | ||
variables=("OIDC_ISSUER" "DB_USERNAME" "DB_PASSWORD" "DB_HOST" "DATABASE_NAME" "DB_PROTOCOL" "TESTING" "VITE_APP_LOGIN_URL" "HYDROSHARE_META_READ_URL" "HYDROSHARE_FILE_READ_URL" "SEARCH_RELEVANCE_SCORE_THRESHOLD") | ||
# Empty the .env file | ||
> .env | ||
|
@@ -57,8 +56,11 @@ jobs: | |
done | ||
- name: Compile the frontend env file | ||
env: | ||
VITE_APP_GOOGLE_MAPS_API_KEY: ${{ secrets.VITE_APP_GOOGLE_MAPS_API_KEY }} | ||
|
||
run: | | ||
variables=("VUE_APP_NAME" "VUE_APP_API_URL" "VUE_APP_SUPPORT_EMAIL" "VUE_APP_URL" "VUE_APP_LOGIN_URL" "VUE_APP_CLIENT_ID" "VUE_APP_GOOGLE_MAPS_API_KEY") | ||
variables=("VITE_APP_NAME" "VITE_APP_API_URL" "VITE_APP_SUPPORT_EMAIL" "VITE_APP_URL" "VITE_APP_LOGIN_URL" "VITE_APP_CLIENT_ID" "VITE_APP_GOOGLE_MAPS_API_KEY") | ||
# Empty the .env file | ||
> frontend/.env | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"editor.detectIndentation": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# import all adapters here to get them registered | ||
from api.adapters import hydroshare | ||
from api.adapters import s3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import boto3 | ||
import json | ||
from botocore.client import Config | ||
from botocore import UNSIGNED | ||
|
||
from api.adapters.base import AbstractRepositoryMetadataAdapter, AbstractRepositoryRequestHandler | ||
from api.adapters.utils import RepositoryType, register_adapter | ||
from api.models.catalog import DatasetMetadataDOC | ||
from api.models.user import Submission, SubmissionType | ||
|
||
|
||
class _S3RequestHandler(AbstractRepositoryRequestHandler): | ||
def get_metadata(self, record_id: str): | ||
endpoint_url = record_id.split("+")[0] | ||
bucket_name = record_id.split("+")[1] | ||
file_key = record_id.split("+")[2] | ||
|
||
s3 = boto3.client('s3', config=Config(signature_version=UNSIGNED), endpoint_url=endpoint_url) | ||
|
||
response = s3.get_object(Bucket=bucket_name, Key=file_key) | ||
json_content = response['Body'].read().decode('utf-8') | ||
|
||
# Parse the JSON content | ||
data = json.loads(json_content) | ||
|
||
return data | ||
|
||
|
||
class S3MetadataAdapter(AbstractRepositoryMetadataAdapter): | ||
repo_api_handler = _S3RequestHandler() | ||
|
||
@staticmethod | ||
def to_catalog_record(metadata: dict) -> DatasetMetadataDOC: | ||
return DatasetMetadataDOC(**metadata) | ||
|
||
@staticmethod | ||
def to_repository_record(catalog_record: DatasetMetadataDOC): | ||
"""Converts dataset catalog record to hydroshare resource metadata""" | ||
raise NotImplementedError | ||
|
||
@staticmethod | ||
def update_submission(submission: Submission, repo_record_id: str) -> Submission: | ||
"""Sets additional hydroshare specific metadata to submission record""" | ||
|
||
submission.repository_identifier = repo_record_id | ||
submission.repository = RepositoryType.S3 | ||
return submission | ||
|
||
|
||
register_adapter(RepositoryType.S3, S3MetadataAdapter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
class RepositoryType(str, Enum): | ||
HYDROSHARE = 'HYDROSHARE' | ||
S3 = 'S3' | ||
|
||
|
||
_adapter_registry = {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.