Skip to content
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

feat: Add item endpoint #61

Merged
merged 34 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c8b2b1b
doc: add CHANGELOG generated thanks to git-cliff
RakuJa May 19, 2024
c7e5570
chore: satisfy frontend requests for alignment random generator to be…
RakuJa May 21, 2024
075fff5
feat:
RakuJa May 21, 2024
c311ea1
chore: remove alignment trait from get_creature
RakuJa May 22, 2024
584f659
Merge branch 'refs/heads/add_changelog' into add_item_endpoint
RakuJa May 22, 2024
13697be
feat: introduce possibility to filter with pathfinder versions
RakuJa May 26, 2024
debb3b2
chore: merge
RakuJa May 26, 2024
ccf6e56
feat:
RakuJa May 26, 2024
631f564
doc: add changelog
RakuJa May 27, 2024
293e2b7
doc: update README.md
RakuJa May 27, 2024
b8c6887
chore: CI refactor
RakuJa May 30, 2024
b7c21aa
chore: divide actions
RakuJa May 30, 2024
96c90dc
chore: update actions
RakuJa May 30, 2024
51e3806
chore: update actions
RakuJa May 30, 2024
8b2aa2a
chore: update actions
RakuJa May 30, 2024
11a1da2
chore: update actions
RakuJa May 30, 2024
7d05fc5
chore: refactor actions
RakuJa May 30, 2024
0c23924
Merge branch 'refs/heads/add_changelog' into add_item_endpoint
RakuJa May 30, 2024
583ab83
feat: add total item count for pagination
RakuJa May 30, 2024
c7ad8d8
doc: update item swagger
RakuJa May 30, 2024
aad2a7c
fix: pf version filter
RakuJa May 30, 2024
ea8dce0
feat: add total for creature
RakuJa May 30, 2024
e100570
chore: changed response item to uniform with creature response
RakuJa May 30, 2024
ea6138a
refactor: pagination, folder structure,
RakuJa Jun 5, 2024
39f0b44
feat: introduce weapon and armor in shop and random gen. fix ranged/m…
RakuJa Jun 6, 2024
38fb761
fix: Dockerfile not building for new curl dependency from swagger-ui
RakuJa Jun 6, 2024
acbee1f
Merge branch 'refs/heads/master' into add_item_endpoint
RakuJa Jun 6, 2024
fe364ee
fix: swagger with wrong response data
RakuJa Jun 6, 2024
9520081
feat: add creature armor, fix weapon duplicates, fix weapon base item…
RakuJa Jun 8, 2024
55d5fb8
feat:
RakuJa Jul 7, 2024
9406c09
feat:
RakuJa Jul 7, 2024
071477f
chore: add rarity sorting
RakuJa Jul 7, 2024
710fc64
chore: optimize regex usage, avoid useless recreation of Regex instan…
RakuJa Jul 7, 2024
0e02d27
chore:
RakuJa Jul 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
doc: add changelog
  • Loading branch information
RakuJa committed May 27, 2024
commit 631f564762ffc0f562d7b02a2462278770184018
76 changes: 76 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
on: workflow_call
jobs:

push-changelog:
name: Generate changelog
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate a changelog
uses: orhun/git-cliff-action@v3
with:
config: cliff.toml
args: --verbose
env:
OUTPUT: CHANGELOG.md
GITHUB_REPO: ${{ github.repository }}

- name: Commit
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
set +e
git add CHANGELOG.md
git commit -m "Update changelog"
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git add_changelog




changelog:
name: Generate changelog
runs-on: ubuntu-latest
outputs:
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate a changelog
uses: orhun/git-cliff-action@v3
id: git-cliff
with:
config: cliff.toml
args: -vv --latest --strip header
env:
OUTPUT: CHANGES.md
GITHUB_REPO: ${{ github.repository }}

# use release body in the same job
- name: Upload the binary releases
uses: svenstaro/upload-release-action@v2
with:
file: binary_release.zip
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
body: ${{ steps.git-cliff.outputs.content }}

# use release body in another job
upload:
name: Upload the release
needs: changelog
runs-on: ubuntu-latest
steps:
- name: Upload the binary releases
uses: svenstaro/upload-release-action@v2
with:
file: binary_release.zip
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
body: ${{ needs.changelog.outputs.release_body }}
5 changes: 2 additions & 3 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
on: push
name: Clippy check

on:
workflow_call:
# Make sure CI fails on all warnings, including Clippy lints
env:
RUSTFLAGS: "-Dwarnings"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
on: pull_request
on: [workflow_call]

name: Rustfmt

Expand All @@ -15,4 +15,4 @@ jobs:
- uses: mbrobbel/rustfmt-check@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
mode: review
mode: review
16 changes: 16 additions & 0 deletions .github/workflows/push_on_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on: push
name: Push on main

jobs:
check:
uses: ./.github/workflows/clippy.yml
with:
job: clippy_check
format:
uses: ./.github/workflows/fmt.yml
with:
job: format
changelog:
uses: ./.github/workflows/changelog.yml
with:
job: push-changelog
109 changes: 109 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.0] - 2024-05-19

### Feature

- Introduce pwl, remove lazy static where used. (#47)
- Refactor Creature response according to new db and remastered (#48)
- Introduce Creature Role (#49)
- Refactor DB communication, remove moka cache (#51)

## [1.2.0] - 2024-01-17

### Feature

- Allow variants on encounter generation (#37)

### Fixed

- Change default from any to no alignment (#39)
- Any not converted correctly from db string (#40)

## [1.0.0] - 2023-11-16

### Added

- Add gunicorn support, expand config usage, fix docker image
- Add encounter info: encounter difficulty, exp and difficulty thresholds
- Add endpoint to fetch creature fields (family, rarity, size, alignment), page size must be greater or equal than 1, generalize fetch_keys redis_handler method
- Add method to procedurally create endpoints ending with or without /
- Add weak and elite endpoints
- Add melee, ranged, spell caster and sources fields. add melee, ranged and spell caster filters (#14)
- Add health controller
- Add get filter routers, use dbcache filters field, separate a little bit the cache logic and router initialization
- Add elite and weak modifier. Complete bestiary
- Add swagger at swagger-ui endpoint
- Add get_encounter_info logic

### Changed

- Flake8 refactor
- Introduce list validation, change endpoint name to a more Rest like naming scheme
- Expand Creature object
- Bump version
- Refactor following ruff guidelines (#13)
- Refactor from rocket to actix-web
- Run clippy linter, add pre-commit, add Dockerfile
- Update bestiary swagger, refactor id endpoint
- Allow cors, optimize dockerignore, fix Dockerfile
- Rename difficulty to challenge, return metadata enums in UPPERCASE
- Return enum fields in caps and null as vec result when enc gen failed with error. Remove various debug
- Rename encounter_challenge to challenge, format any
- Refactor get single creature to not call redis each time
- Update readme
- Add valid rust actions
- 1.0.0 release (#32)

### Feature

- Backend is now deployment ready using docker and fly.io
- Implement random encounter generator, redis_handler can now fetch ids that pass filters
- Allow encounter generation with no filter, difficulty is randomized and the rest ignored
- Introduce get creature API, add filter name to list API
- Add sort and label filters (#6)
- Add level and hp (min, max) filters (#9)
- Refactor using rust
- Implement cache (that needs to be refactored, it's ported 1:1 from python code)
- Implement full feature routing for bestiary list, with filters and default values.
- Allow request without pagination
- Implement encounter generation in rust (#16)
- Refactor cache to make it more rusty. This has the problem that it will have a slow first call every 24hours for one unlucky user
- Parse sources and return them correctly
- Parse complex sources strings
- Implement traits (#19)
- Implement creature types (#21)
- Implement multiple filter values (#23)
- Implement cache control (#25)
- Implement SQLite db (#28)
- Implement source endpoint (#30)
- Implement generator filtering by number of creatures (#31)

### Fixed

- Now get_bestiary returns json instead of string
- Handle difference between negative levels when calculating encounter info
- Next element wrong address
- Allow CORS calls
- Simplify calculate_encounter_difficulty, fix logical bug with trivial difficulty
- Populate new_ids_dict correctly (#7)
- Side effect on creature cache (#11)
- Refactor to handle correctly json body on post
- Use of scan instead of keys, that raised an error when the number of keys is high
- Creature_id endpoint overriding rarities, families, size, alignment etc
- Encounter info returning impossible on trivial encounters
- Pagination taking more element than requested
- Ln string not in caps
- Encounter info broken with negative enemies
- Set filtering was doing union operation instead of intersection
- Filter correctly vectors containing integer with value < -1

[1.3.0]: https://github.com///compare/v1.2.0..v1.3.0
[1.2.0]: https://github.com///compare/v1.0.0..v1.2.0

<!-- generated by git-cliff -->
78 changes: 78 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# git-cliff ~ configuration file
# https://git-cliff.org/docs/configuration

[changelog]
# changelog header
header = """
# Changelog\n
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n
"""
body = """
{% if version -%}
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else -%}
## [Unreleased]
{% endif -%}
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
- {{ commit.message | upper_first }}\
{% endfor %}
{% endfor %}\n
"""
# template for the changelog footer
footer = """
{% for release in releases -%}
{% if release.version -%}
{% if release.previous.version -%}
[{{ release.version | trim_start_matches(pat="v") }}]: \
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
/compare/{{ release.previous.version }}..{{ release.version }}
{% endif -%}
{% else -%}
[unreleased]: https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
/compare/{{ release.previous.version }}..HEAD
{% endif -%}
{% endfor %}
<!-- generated by git-cliff -->
"""
# remove the leading and trailing whitespace from the templates
trim = true

[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^.*: add", group = "Added" },
{ message = "^.*: support", group = "Added" },
{ message = "^.*: remove", group = "Removed" },
{ message = "^.*: delete", group = "Removed" },
{ message = "^feat", group = "Feature"},
{ message = "^doc", group = "Documentation"},
{ message = "^test", group = "Fixed" },
{ message = "^fix", group = "Fixed" },
{ message = "^.*: fix", group = "Fixed" },
{ message = "^.*", group = "Changed" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = true
# regex for matching git tags
tag_pattern = "v[0-9].*"
# regex for skipping tags
skip_tags = "v0.1.0-beta.1"
# regex for ignoring tags
ignore_tags = ""
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"