-
Notifications
You must be signed in to change notification settings - Fork 3
feat: remove title and company link #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,13 +1,65 @@ | ||
| .env | ||
| secret* | ||
| # Python | ||
| __pycache__/ | ||
| *.py[cod] | ||
| *.pyo | ||
| *.pyd | ||
| *.so | ||
| *.egg | ||
| *.egg-info/ | ||
| dist/ | ||
| build/ | ||
|
|
||
| # Environnements virtuels | ||
| .venv/ | ||
| venv/ | ||
| __pycache__/ | ||
| *.pyc | ||
| env/ | ||
| ENV/ | ||
|
|
||
| # Variables d'environnement — ne jamais commiter | ||
| .env | ||
| app/.env | ||
| !*.env.example | ||
| !app/.env.example | ||
|
|
||
| # Secrets | ||
| secret* | ||
| *.key | ||
| *.pem | ||
|
|
||
| # Bases de données locales | ||
| *.db | ||
| *.sqlite3 | ||
|
|
||
| # Logs | ||
| *.log | ||
| logs/ | ||
|
|
||
| # IDEs | ||
| .vscode/ | ||
| .idea/ | ||
| *.iml | ||
| *.sublime-project | ||
| *.sublime-workspace | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
| desktop.ini | ||
|
|
||
| # Tests | ||
| .coverage | ||
| .pytest_cache/ | ||
| .mypy_cache/ | ||
| .tox/ | ||
| htmlcov/ | ||
| coverage.xml | ||
| mock* | ||
| fake* | ||
| test* | ||
| tests/ | ||
| .vscode/ | ||
| .idea/ | ||
| .DS_Store | ||
|
|
||
| # Divers | ||
| *.bak | ||
| *.tmp | ||
| *.swp | ||
| *.swo |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -47,14 +47,20 @@ async def lifespan(app: FastAPI): | |
| await app.state.redis_client.close() | ||
|
|
||
|
|
||
| _is_dev = settings.env in ["dev", "local", "development"] | ||
|
|
||
| app = FastAPI( | ||
| title=settings.app_name, | ||
| version="2.1.0", | ||
| license_info={ | ||
| "name": "Apache 2.0", | ||
| "url": "https://www.apache.org/licenses/LICENSE-2.0.html" | ||
| }, | ||
| lifespan=lifespan) | ||
| lifespan=lifespan, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On'a besoin de la docs pour l'intregration. pour le moment on va le garderet travailler a mettre une authentification au lieux de le bloquer carrement. |
||
| openapi_url="/openapi.json" if _is_dev else None, | ||
| docs_url="/docs" if _is_dev else None, | ||
| redoc_url="/redoc" if _is_dev else None, | ||
| ) | ||
|
|
||
|
|
||
| app.add_middleware( | ||
|
|
||
This file contains hidden or 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 hidden or 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,103 @@ | ||
| from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, status | ||
|
|
||
| from app.database.connection import get_db_connection | ||
| from app.schemas.models import JobOfferCreate, JobOfferSummary, JobOfferUpdate, MessageResponse | ||
| from app.utils.job_offers import ( | ||
| add_job_offer, | ||
| delete_job_offer, | ||
| get_active_job_offers, | ||
| get_all_job_offers, | ||
| get_job_offer_by_id, | ||
| update_job_offer, | ||
| ) | ||
| from app.core.settings import logger | ||
|
|
||
|
|
||
| api_router = APIRouter(prefix="/job-offers", tags=["job-offers"]) | ||
|
|
||
|
|
||
| @api_router.post("/create", response_model=MessageResponse, status_code=status.HTTP_201_CREATED) | ||
| async def create_job_offer( | ||
| job_offer: JobOfferCreate, | ||
| background_tasks: BackgroundTasks, | ||
| db=Depends(get_db_connection), | ||
| ): | ||
| """Create a new job offer.""" | ||
| try: | ||
| return await add_job_offer(db, job_offer, background_tasks) | ||
| except Exception as e: | ||
| if isinstance(e, HTTPException): | ||
| raise e | ||
| raise HTTPException(status_code=500, detail="Internal server error") | ||
|
|
||
|
|
||
| @api_router.get("/list/active", response_model=list[JobOfferSummary]) | ||
| async def list_active_job_offers(db=Depends(get_db_connection)): | ||
| """List all active job offers.""" | ||
| try: | ||
| job_offers = await get_active_job_offers(db) | ||
| if not job_offers: | ||
| raise HTTPException( | ||
| status_code=status.HTTP_404_NOT_FOUND, | ||
| detail="No active job offers found", | ||
| ) | ||
| return job_offers | ||
| except Exception as e: | ||
| logger.error(f"Error listing active job offers: {str(e)}") | ||
| if isinstance(e, HTTPException): | ||
| raise e | ||
| raise HTTPException(status_code=500, detail="Internal server error") | ||
|
|
||
|
|
||
| @api_router.get("/list", response_model=list[JobOfferSummary]) | ||
| async def list_all_job_offers(db=Depends(get_db_connection)): | ||
| """List all job offers (admin).""" | ||
| try: | ||
| return await get_all_job_offers(db) | ||
| except Exception as e: | ||
| logger.error(f"Error listing all job offers: {str(e)}") | ||
| if isinstance(e, HTTPException): | ||
| raise e | ||
| raise HTTPException(status_code=500, detail="Internal server error") | ||
|
|
||
|
|
||
| @api_router.get("/{job_offer_id}", response_model=JobOfferSummary) | ||
| async def get_job_offer(job_offer_id: str, db=Depends(get_db_connection)): | ||
| """Retrieve a job offer by its ID.""" | ||
| try: | ||
| return await get_job_offer_by_id(db, job_offer_id) | ||
| except Exception as e: | ||
| if isinstance(e, HTTPException): | ||
| raise e | ||
| raise HTTPException(status_code=500, detail="Internal server error") | ||
|
|
||
|
|
||
| @api_router.put("/update/{job_offer_id}", response_model=MessageResponse) | ||
| async def update_job_offer_details( | ||
| job_offer_id: str, | ||
| job_offer_update: JobOfferUpdate, | ||
| background_tasks: BackgroundTasks, | ||
| db=Depends(get_db_connection), | ||
| ): | ||
| """Update an existing job offer.""" | ||
| try: | ||
| return await update_job_offer(db, job_offer_id, job_offer_update, background_tasks) | ||
| except Exception as e: | ||
| if isinstance(e, HTTPException): | ||
| raise e | ||
| raise HTTPException(status_code=500, detail="Internal server error") | ||
|
|
||
|
|
||
| @api_router.delete("/delete/{job_offer_id}", response_model=MessageResponse) | ||
| async def delete_job_offer_by_id( | ||
| job_offer_id: str, | ||
| background_tasks: BackgroundTasks, | ||
| db=Depends(get_db_connection), | ||
| ): | ||
| """Delete a job offer by its ID.""" | ||
| try: | ||
| return await delete_job_offer(db, job_offer_id, background_tasks) | ||
| except Exception as e: | ||
| if isinstance(e, HTTPException): | ||
| raise e | ||
| raise HTTPException(status_code=500, detail="Internal server error") |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Steventog, merci beaucoup pour ta contribution.