-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨(api) implement dynamique endpoints
A first naive implementation of dynamique endpoints has been drafted. We know that current implementation won't scale, but we need further discussions to refine our approach.
- Loading branch information
Showing
10 changed files
with
836 additions
and
52 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
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 +1,36 @@ | ||
"""QualiCharge factories.""" | ||
|
||
from datetime import datetime, timedelta, timezone | ||
from typing import Generic, TypeVar | ||
from uuid import uuid4 | ||
|
||
from faker import Faker | ||
from polyfactory import Use | ||
from polyfactory.factories.dataclass_factory import DataclassFactory | ||
from polyfactory.factories.sqlalchemy_factory import SQLAlchemyFactory | ||
|
||
T = TypeVar("T") | ||
|
||
|
||
class FrenchDataclassFactory(Generic[T], DataclassFactory[T]): | ||
"""Dataclass factory using the french locale.""" | ||
|
||
__faker__ = Faker(locale="fr_FR") | ||
__is_base_factory__ = True | ||
|
||
|
||
class TimestampedSQLModelFactory(Generic[T], SQLAlchemyFactory[T]): | ||
"""A base factory for timestamped SQLModel. | ||
We expect SQLModel to define the following fields: | ||
- id: UUID | ||
- created_at: datetime | ||
- updated_at: datetime | ||
""" | ||
|
||
__is_base_factory__ = True | ||
|
||
id = Use(uuid4) | ||
created_at = Use(lambda: datetime.now(timezone.utc) - timedelta(hours=1)) | ||
updated_at = Use(datetime.now, timezone.utc) |
Oops, something went wrong.