Commit Graph

528 Commits

Author SHA1 Message Date
MingxuanGame
554f1e6432 fix(daily-challenge): last_update will return correct time to display in client 2025-08-30 10:26:12 +00:00
陈晋瑭
6c2e88c485 feat(beatmap): 添加谱面用户标签功能 (#25)
* feat(tags): 添加 beatmap tags 相关功能

- 新增 BeatmapTags 模型类,用于表示 beatmap 的标签信息
- 实现加载标签数据、根据 ID 获取标签、获取所有标签等功能

* feat(database): 新增 BeatmapTagVote 数据库模型和迁移脚本

* fix(database): 修改 BeatmapTagVote 模型并创建新表

- 将 BeatmapTagVote 模型的表名从 "beatmap_tag_votes" 改为 "beatmap_tags"
- 创建新的数据库迁移文件以替换错误的原迁移文件
- 删除错误的迁移文件 "4a827ddba235_add_table_beatmap_tags.py"

* feat(tags): 添加用户标签功能

- 在 BeatmapResp 类中添加了 top_tag_ids 和 current_user_tag_ids 字段
- 新增了 /tags 相关的路由,包括获取所有标签和投票/取消投票功能
- 实现了标签投票和取消投票的数据库操作

* fix(tags): 修复标签投票查询和返回过程中的逻辑问题

- 修复 BeatmapResp 类中 current_user_tag_ids 字段的查询逻辑
- 优化 vote_beatmap_tags 函数中的标签验证过程

* fix(tags): add suggested changes from reviews

- 在 BeatmapResp 中添加 top_tag_ids 和 current_user_tag_ids 字段
- 实现用户标签投票功能,包括检查用户是否有资格投票
- 优化标签数据的加载方式
- 调整标签相关路由,增加路径参数描述

* fix(tags): apply changes from review

* fix(tag): apply changes from review suggests

- 更新标签接口文档,统一参数描述
- 修改标签投票接口状态码为 204
- 优化标签投票接口的用户认证方式
- 改进标签相关错误处理,使用更友好的错误信息

* fix(tag): use client authorization

* chore(linter): auto fix by pre-commit hooks

---------

Co-authored-by: MingxuanGame <MingxuanGame@outlook.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-30 16:23:59 +08:00
MingxuanGame
d38cf12826 fix(daily-challenge): fix don't calculate user's statistics 2025-08-29 16:19:37 +08:00
MingxuanGame
224e890e31 feat(recalculate): add scheduled job to recalculate failed scores 2025-08-28 16:53:15 +00:00
MingxuanGame
fdb08fe31f fix(rate-limit): apply on router to avoid TypeError on ws endpoint 2025-08-28 16:41:33 +00:00
MingxuanGame
4324d7ed2b deploy(docker): use gu pp algorithm for osurx 2025-08-28 15:13:50 +00:00
MingxuanGame
e35e7ee0ef ci(docker): auto publish to Docker Hub 2025-08-28 15:05:59 +00:00
MingxuanGame
bc2f481323 chore(revert): revert "feat(score): use gu pp algorithm" due to pp algorithm will crash
This reverts commit dfe173b40f.
2025-08-28 14:32:36 +00:00
MingxuanGame
d5aaab480b docs(readme): update readme 2025-08-28 14:28:49 +00:00
MingxuanGame
aa239a81fa feat(api): add rate limiting for API requests 2025-08-28 13:51:44 +00:00
MingxuanGame
c7f6c76b0f refactor(api): standardizate API Router 2025-08-28 13:49:34 +00:00
陈晋瑭
3c5336ed61 添加谱面用户打分(评分)相关接口 (#24)
* feat(database): 添加 beatmap_ratings 表用于用户评分

- 新增 BeatmapRating 模型类,用于表示 beatmap_ratings 表
- 该表包含 id、beatmapset_id、user_id 字段
- 建立与 Beatmapset 和 User 表的关联关系

* feat(beatmapset_ratings): 添加判断用户是否可以对谱面集进行评分的接口

- 新增 /beatmapsets/{beatmapset_id}/can_rate 接口
- 判断用户是否能对谱面集进行过评分,返回True/False

* feat(ratings): 添加为谱面评分的接口

- 新增 POST /beatmapsets/{beatmapset_id} 路由,用于用户给谱面集评分
- 实现谱面集评分的添加和更新逻辑
- 在 BeatmapRating 模型中添加 rating 字段 (漏了最重要的,我真tm丢脸)

* chore(database): 添加alembic数据库迁移脚本

* fix(ratings): 更改上传谱面打分的api路径,防止冲突

* fix(ratings): add changes from pr review

* refactor(ratings): remove swears from code

* feat(ratings): 从beatmapset中移除ratings字段,并改由从beatmap_ratings表中直接计算评分

* chore(deps): 添加 git 包并更新依赖项

- 在 builder 阶段添加了 git 包的安装

* chore(database): 更新数据库连接地址并删除意外的迁移脚本

- 将 Alembic 配置文件中的数据库连接地址从本地地址改为 Docker Compose 中的 mysql 服务地址
- 删除了 migrations/versions 目录下的 dba1f8d9992e_add_beatmap_ratings_table.py 文件

* chore(database): generate alembic script for beatmap ratings

* fix(ratings): apply changes suggested in review

- revert changes to alembic.ini
- add name to apis
- modify migration scripts

* chore: format server.py using ruff

- who forgot to do this?

* fix(migrate): fix remove achievement index

* perf(rating): optimize SQL query

* fix(rating): ensure user can rate beatmapset

* fix(rating): add boundary check

* chore(project): remove submodule

---------

Co-authored-by: MingxuanGame <MingxuanGame@outlook.com>
2025-08-28 20:55:00 +08:00
MingxuanGame
80b102af2d feat(storage): support remove old files 2025-08-28 12:17:35 +00:00
MingxuanGame
cbc46d63b6 chore(dev): remove submodule & update contribution guide 2025-08-28 10:13:49 +00:00
MingxuanGame
d1fc10626b fix(team): modifying name or short name doesn't work 2025-08-28 09:54:02 +00:00
咕谷酱
7a0283086d Update server.py 2025-08-28 04:21:43 +08:00
MingxuanGame
1f53c66700 fix(recalculate): save pp to original score 2025-08-27 21:20:59 +08:00
MingxuanGame
dfe173b40f feat(score): use gu pp algorithm 2025-08-27 14:06:10 +08:00
MingxuanGame
7ec716d4de feat(user): support get the user's first scores 2025-08-26 16:42:57 +00:00
MingxuanGame
d2e3b86bd1 feat(user): only show activities of the last 30 days 2025-08-26 16:07:27 +00:00
MingxuanGame
bc12182770 fix(user): rank lost event uses the owner of the displaced score's username 2025-08-26 15:53:32 +00:00
MingxuanGame
60745c1269 feat(score): auto recalculate for banned beatmaps
Running every hour
2025-08-26 15:12:14 +00:00
MingxuanGame
f8535fdce4 feat(user): support login with any case of username & email 2025-08-26 11:39:55 +00:00
MingxuanGame
8d9f1d2750 feat(ranking): support team ranking 2025-08-26 10:51:31 +00:00
MingxuanGame
46b60e555f refactor(recalculate): optimize batch processing and use semaphore 2025-08-26 13:18:11 +08:00
MingxuanGame
900fa9b121 fix(score): fix incorrect best_id 2025-08-26 13:18:11 +08:00
MingxuanGame
9681aa68b4 feat(banchobot): show weighted pp in score commands 2025-08-26 13:18:11 +08:00
MingxuanGame
d11303b562 fix(score): return failed score which read from cache & remove legacy score error 2025-08-26 13:18:11 +08:00
MingxuanGame
81a07b5544 refactor(migration): remove empty migration 2025-08-26 13:18:11 +08:00
MingxuanGame
8810eabfd3 deploy(docker): fix spectator server connot connect to database 2025-08-26 13:18:11 +08:00
MingxuanGame
db30cb31dc fix(daily-challenge): fix don't clear the streak when it has been broken 2025-08-26 13:18:11 +08:00
MingxuanGame
d873c227c1 refactor(stats): remove stats manager 2025-08-26 13:18:11 +08:00
MingxuanGame
bab6f843a5 fix(user): fix online status 2025-08-26 13:18:11 +08:00
咕谷酱
d470ee1482 Update docker-compose-osurx.yml 2025-08-26 13:18:11 +08:00
MingxuanGame
29857506f2 refactor(lio): use REALTIME for multiplayer room 2025-08-26 13:18:11 +08:00
MingxuanGame
292e6b0eba chore(linter): make lint happy 2025-08-26 13:18:11 +08:00
MingxuanGame
debb4cb110 deploy(docker): update configuration 2025-08-26 13:18:11 +08:00
MingxuanGame
6ae64fd50c refactor(lio): remove unused hmac validation 2025-08-26 13:18:11 +08:00
MingxuanGame
d08b39d482 refactor(lio): remove unused hmac validation 2025-08-26 13:18:11 +08:00
MingxuanGame
9d92fa0a68 fix(score): fix score process 2025-08-26 13:18:11 +08:00
MingxuanGame
2f033f108a fix(playlist): cannot get playlist rooms 2025-08-26 13:18:11 +08:00
MingxuanGame
8d38f230cb refactor(room): remove duplicated multiplayer event model 2025-08-26 13:18:11 +08:00
MingxuanGame
6c04b15764 feat(lio): support upload replay 2025-08-26 13:18:11 +08:00
MingxuanGame
86c6c291e4 chore(dev): update dev environment 2025-08-26 13:18:11 +08:00
咕谷酱
7eea68aa9a Update notification.py 2025-08-26 13:18:11 +08:00
pre-commit-ci[bot]
282ae3895e chore(deps): auto fix by pre-commit hooks 2025-08-26 13:18:11 +08:00
咕谷酱
ccfafd9c5f Add fallback for user avatar URL in notifications
Ensures that a default avatar URL is used if the user object lacks an avatar_url attribute or if an exception occurs, improving robustness of notification cover images.
2025-08-26 13:18:11 +08:00
pre-commit-ci[bot]
7625cd99f5 chore(deps): auto fix by pre-commit hooks 2025-08-26 13:18:11 +08:00
咕谷酱
b4fd4e0256 Handle rate limit errors in BeatmapsetFetcher
Introduces RateLimitError to manage 429 responses from the API, updating request_api to raise this error and adding handling in prefetch and warmup logic to skip or log when rate limits are hit. Also improves error handling for authentication failures and token expiration.
2025-08-26 13:18:11 +08:00
咕谷酱
8adc88bf00 Remove retry logic from BaseFetcher API requests
Simplified the BaseFetcher class by removing the max_retries parameter and all related retry and reauthorization logic. API requests now fail immediately on authentication errors, and token clearing is handled by a new _clear_tokens method. This change streamlines error handling and reduces complexity.
2025-08-26 13:18:11 +08:00