mirror of
https://github.com/creyD/creyPY.git
synced 2026-04-12 19:30:30 +02:00
Compare commits
16 Commits
1.3.0
...
2.0.0rc.de
| Author | SHA1 | Date | |
|---|---|---|---|
| d54146e05b | |||
| d6f79c3ed8 | |||
| 3f4a0ee00d | |||
| 714178d68f | |||
| c7e205f14b | |||
| 39ae74becb | |||
| 5f39966223 | |||
| c91e684f08 | |||
| f11b8b8864 | |||
| 983553e97a | |||
| 8740eafce2 | |||
| aa44b9ebe9 | |||
| 851573d964 | |||
| cfa1da08d3 | |||
| 4a5a777ef5 | |||
| c9a9b1bc0a |
21
.github/workflows/ci.yml
vendored
21
.github/workflows/ci.yml
vendored
@@ -46,8 +46,8 @@ jobs:
|
||||
- run: python test.py
|
||||
|
||||
tag_and_publish:
|
||||
if: github.ref == 'refs/heads/master'
|
||||
runs-on: ubuntu-latest
|
||||
if: github.head_ref == 'master' || github.head_ref == 'dev'
|
||||
needs: test
|
||||
permissions:
|
||||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
||||
@@ -57,7 +57,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-tags: true
|
||||
ref: ${{ github.ref }}
|
||||
ref: ${{ github.head_ref }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: setup git
|
||||
@@ -71,12 +71,19 @@ jobs:
|
||||
with:
|
||||
minor-identifier: "feat:"
|
||||
major-identifier: "breaking:"
|
||||
release-branch: ${{ github.head_ref }}
|
||||
|
||||
- name: Create Tag
|
||||
run: git tag ${{ steps.git_version.outputs.version }}
|
||||
|
||||
- name: Push tag
|
||||
run: git push origin ${{ steps.git_version.outputs.version }}
|
||||
- name: Create & Push Tag
|
||||
if: github.head_ref == 'master' || github.head_ref == 'dev'
|
||||
run: |
|
||||
if [ "${{ github.head_ref }}" == "master" ]; then
|
||||
git tag ${{ steps.git_version.outputs.version }}
|
||||
git push origin ${{ steps.git_version.outputs.version }}
|
||||
elif [ "${{ github.head_ref }}" == "dev" ]; then
|
||||
calculatedSha=$(git rev-parse --short ${{ github.sha }})
|
||||
git tag ${{ steps.git_version.outputs.version }}rc.dev${calculatedSha}
|
||||
git push origin ${{ steps.git_version.outputs.version }}rc.dev${calculatedSha}
|
||||
fi
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
|
||||
19
CHANGELOG.md
19
CHANGELOG.md
@@ -2,6 +2,25 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## 2.0.0
|
||||
|
||||
- Fixed #1 Rename misspelled additonal_data to additional_data on create_obj_from_data
|
||||
- Fixed #3 Inverse partial flag: bool = False because it was wrong on update_obj_from_data
|
||||
|
||||
Notes:
|
||||
|
||||
You will need to change calls to `create_obj_from_data` according to #1 (rename additonal_data to additional_data)
|
||||
|
||||
You will need to change calls to `update_obj_from_data` according to #3 (if you supplied `partial`, you will need to reverse it: `true` -> `false` and `false` -> `true`)
|
||||
|
||||
## 1.3.0
|
||||
|
||||
- Addition of pagination proxy and pagination=off functionality (Thanks to @vikbhas)
|
||||
|
||||
## 1.2.5
|
||||
|
||||
- Bumped dependencies
|
||||
|
||||
## 1.2.4
|
||||
|
||||
- Enabled newer versions for all dependencies
|
||||
|
||||
@@ -23,9 +23,9 @@ def get_object_or_404(
|
||||
|
||||
# TODO: Add testing
|
||||
def create_obj_from_data(
|
||||
data: BaseModel, model: Type[T], db: Session, additonal_data={}, exclude={}
|
||||
data: BaseModel, model: Type[T], db: Session, additional_data={}, exclude={}
|
||||
) -> T:
|
||||
obj = model(**data.model_dump(exclude=exclude) | additonal_data)
|
||||
obj = model(**data.model_dump(exclude=exclude) | additional_data)
|
||||
db.add(obj)
|
||||
db.commit()
|
||||
db.refresh(obj)
|
||||
@@ -38,13 +38,13 @@ def update_obj_from_data(
|
||||
model: Type[T],
|
||||
id: UUID | str,
|
||||
db: Session,
|
||||
partial: bool = False, # TODO: inverse, because it is currently the wrong way around
|
||||
partial: bool = True,
|
||||
ignore_fields=[],
|
||||
additional_data={},
|
||||
exclude={},
|
||||
) -> T:
|
||||
obj = get_object_or_404(model, id, db)
|
||||
data_dict = data.model_dump(exclude_unset=not partial, exclude=exclude)
|
||||
data_dict = data.model_dump(exclude_unset=partial, exclude=exclude)
|
||||
data_dict.update(additional_data) # merge additional_data into data_dict
|
||||
for field in data_dict:
|
||||
if field not in ignore_fields:
|
||||
|
||||
@@ -102,8 +102,7 @@ def paginate(
|
||||
transformer: Optional[SyncItemsTransformer] = None,
|
||||
additional_data: Optional[AdditionalData] = None,
|
||||
):
|
||||
|
||||
params, raw_params = verify_params(params, "limit-offset", "cursor")
|
||||
params, _ = verify_params(params, "limit-offset", "cursor")
|
||||
|
||||
count_query = create_count_query(query)
|
||||
total = connection.scalar(count_query)
|
||||
|
||||
Reference in New Issue
Block a user