-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# `OpenVaultCatalog` Adds Open Vault Catalog - model - view - crud `/ov/` - auth - `GET /ov/get/{id}` is open to unauthenticated traffic - All other routes protected
- Loading branch information
Showing
6 changed files
with
103 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from csv import DictReader\n", | ||
"\n", | ||
"with open('ov_catalog.csv') as f:\n", | ||
" csv = DictReader(f)\n", | ||
" catalog = list(csv)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from organ.db import engine\n", | ||
"from sqlmodel import Session\n", | ||
"from organ.models import OpenVaultCatalog\n", | ||
"\n", | ||
"with Session(engine) as session:\n", | ||
" for item in catalog:\n", | ||
" session.add(OpenVaultCatalog(**item))\n", | ||
" session.commit()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": ".venv", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
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,31 @@ | ||
from fastapi import Depends | ||
from fastcrud import crud_router | ||
|
||
from organ.db import get_async_session | ||
from organ.models import OpenVaultCatalog, Organization, OrganizationSchema | ||
from organ.oauth import is_user_authenticated | ||
|
||
orgs = crud_router( | ||
model=Organization, | ||
session=get_async_session, | ||
path='/orgs', | ||
tags=['orgs'], | ||
create_schema=OrganizationSchema, | ||
update_schema=OrganizationSchema, | ||
) | ||
|
||
ov_catalog = crud_router( | ||
model=OpenVaultCatalog, | ||
session=get_async_session, | ||
path='/ov', | ||
tags=['ov'], | ||
create_schema=OpenVaultCatalog, | ||
update_schema=OpenVaultCatalog, | ||
create_deps=[Depends(is_user_authenticated)], | ||
read_deps=None, | ||
read_multi_deps=[Depends(is_user_authenticated)], | ||
read_paginated_deps=[Depends(is_user_authenticated)], | ||
update_deps=[Depends(is_user_authenticated)], | ||
delete_deps=[Depends(is_user_authenticated)], | ||
db_delete_deps=[Depends(is_user_authenticated)], | ||
) |
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 was deleted.
Oops, something went wrong.
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