Compare commits

...

33 Commits

Author SHA1 Message Date
eb64874c47 fix: minor adjustment to the pipeline 2024-10-29 15:13:36 +01:00
b7200852a4 Merge branch 'dev' of https://github.com/creyD/creyPY into dev 2024-10-29 15:13:30 +01:00
3d18205205 fix: fixed github pipeline 2024-10-29 15:12:41 +01:00
6806de23b3 fix: fixed github pipeline 2024-10-29 15:06:31 +01:00
6a93ab05a3 Merge pull request #6 from creyD/dev 2024-10-29 14:56:14 +01:00
vikynoah
c5b2ab9932 fix: Add condition for total greater than zero (#7) 2024-10-28 15:37:14 +01:00
5a32a5908b Removed debug statement 2024-10-25 15:34:16 +02:00
b7df0bfdcd fix: added escape for variable names 2024-10-25 15:27:50 +02:00
378d1d60f1 fix: adjusting pipeline for prod as well 2024-10-25 15:22:35 +02:00
e381992f8e fix: fixing dev versioning 2024-10-25 15:09:15 +02:00
6d5411a8ae fix: debugging pipeline 2024-10-25 14:46:35 +02:00
89351d714b fix: debugging pipeline 2024-10-25 14:44:18 +02:00
c24f8933fb fix: attempt on fixing the versioning issue 2024-10-25 14:38:58 +02:00
0bed0e0da4 fix: attempt on fixing the versioning issue 2024-10-25 14:34:56 +02:00
8463eef907 fix: attempt on fixing the versioning issue 2024-10-25 14:25:48 +02:00
5903de2aad fix: fixed semantic versioning format selector 2024-10-25 14:19:11 +02:00
0bf89fe14d fix: switched to semantic versioning action 2024-10-25 14:12:04 +02:00
d54146e05b fix: fixed naming of pre-release commits 2024-10-24 12:41:04 +02:00
d6f79c3ed8 fix: fixed naming of pre-release commits 2024-10-24 12:35:13 +02:00
3f4a0ee00d fix: fixed naming of pre-release commits 2024-10-24 12:25:30 +02:00
714178d68f fix: fixed naming of pre-release commits 2024-10-24 12:22:45 +02:00
c7e205f14b fix: fixed naming of pre-release commits 2024-10-24 12:18:50 +02:00
39ae74becb fix: minor changelog adjustment 2024-10-24 12:15:23 +02:00
5f39966223 fix: Fixed tag pushing and changelog 2024-10-24 12:10:16 +02:00
c91e684f08 fix: fix attempt for the github pipeline 2024-10-24 12:10:16 +02:00
f11b8b8864 fix: alternative attempt on the fix 2024-10-24 12:10:16 +02:00
983553e97a fix: locked tag and publish to master and dev 2024-10-24 12:10:16 +02:00
8740eafce2 fix: fixed pipeline tagging 2024-10-24 12:10:16 +02:00
aa44b9ebe9 fix: fixed pipeline tagging 2024-10-24 12:10:16 +02:00
851573d964 fix: fixed pipeline tagging 2024-10-24 12:10:16 +02:00
cfa1da08d3 fix: pipeline now pushes pre-release versions 2024-10-24 12:10:16 +02:00
4a5a777ef5 breaking: Fixed #3 2024-10-24 12:10:16 +02:00
c9a9b1bc0a breaking: Fixed #1 2024-10-24 12:10:16 +02:00
4 changed files with 49 additions and 18 deletions

View File

@@ -6,7 +6,6 @@ on:
- master
- dev
paths-ignore:
- "**/.github/**"
- "**/.gitignore"
- "**/.vscode/**"
- "**/README.md"
@@ -20,6 +19,7 @@ on:
jobs:
lint:
runs-on: ubuntu-latest
if: github.ref_name != 'master'
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
@@ -36,6 +36,7 @@ jobs:
test:
runs-on: ubuntu-latest
needs: lint
if: github.ref_name != 'master'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
@@ -46,8 +47,8 @@ jobs:
- run: python test.py
tag_and_publish:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
if: github.ref_name == 'dev' || github.ref_name == 'master'
needs: test
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
@@ -57,7 +58,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-tags: true
ref: ${{ github.ref }}
ref: ${{ github.ref_name }}
fetch-depth: 0
- name: setup git
@@ -65,18 +66,30 @@ jobs:
git config --local user.email "15138480+creyD@users.noreply.github.com"
git config --local user.name "creyD"
- name: set version format
id: version_format
run: |
if [[ ${{ github.ref_name }} == 'master' ]]; then
echo "version_format=\${major}.\${minor}.\${patch}" >> $GITHUB_OUTPUT
else
echo "version_format=\${major}.\${minor}.\${patch}rc\${increment}" >> $GITHUB_OUTPUT
fi
- name: Git Version
uses: codacy/git-version@2.8.0
uses: PaulHatch/semantic-version@v5.4.0
id: git_version
with:
minor-identifier: "feat:"
major-identifier: "breaking:"
tag_prefix: ""
major_pattern: "breaking:"
minor_pattern: "feat:"
enable_prerelease_mode: false
version_format: ${{ steps.version_format.outputs.version_format }}
- 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.ref_name == 'master' || github.ref_name == 'dev'
run: |
git tag ${{ steps.git_version.outputs.version }}
git push origin ${{ steps.git_version.outputs.version }}
- name: Set up Python
uses: actions/setup-python@v5

View File

@@ -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

View File

@@ -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:

View File

@@ -102,13 +102,12 @@ 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)
if paginationFlag is False:
if paginationFlag is False and total > 0:
params = Params(page=1, size=total)
query = create_paginate_query(query, params)