Compare commits
53
Commits
27bba95250
..
1.2.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1dfe3f7221
|
||
|
|
86e259a500
|
||
|
|
b91855095b
|
||
|
|
1f30f70f21
|
||
|
|
13242deb6c
|
||
|
|
3b5153f386
|
||
|
|
5502643466
|
||
|
|
5790750124
|
||
|
|
26bca96575
|
||
|
|
381ccae5fd | ||
|
|
752e64f259
|
||
|
|
84a2a2ffea
|
||
|
|
fd2352b6ad | ||
|
|
0efcf75221 | ||
|
|
0479744ce5 | ||
|
|
af58edbafd | ||
|
|
1a16199f2f | ||
|
|
9b2d527576
|
||
|
|
d663cc5d20
|
||
|
|
5d84cf0589
|
||
|
|
84fa103555
|
||
|
|
ff967da485
|
||
|
|
6271b22708 | ||
|
|
6e18d2efa9
|
||
|
|
5803d057fd
|
||
|
|
22da81a102 | ||
|
|
a8959c28ec | ||
|
|
fbbef5c28b
|
||
|
|
6d98ecef30
|
||
|
|
0e695e4266
|
||
|
|
d524b3814c
|
||
|
|
8e98f5b9da
|
||
|
|
9a65fd04c3
|
||
|
|
49fbcb221c
|
||
|
|
e4acb7fd6f | ||
|
|
a66ed2e216
|
||
|
|
0a2f58a91b
|
||
|
|
3f3ff08d25
|
||
|
|
05b355e709
|
||
|
|
a9ddf3e3f8 | ||
|
|
e76e684b4d
|
||
|
|
2fc865ea57
|
||
|
|
ab9be06d5e | ||
|
|
abc4c68a0f
|
||
|
|
ff487064a2
|
||
|
|
e7373d6e98 | ||
|
|
d52ce8828d | ||
|
|
745c98bc20
|
||
|
|
16db0eb0ee
|
||
|
|
a2e3676d05
|
||
|
|
088b0e87ce | ||
|
|
d6b8d12b2e
|
||
|
|
ac76150915
|
No files matched your search
File renamed without changes.
File renamed without changes.
@@ -1,3 +0,0 @@
|
||||
/gradlew text eol=lf
|
||||
*.bat text eol=crlf
|
||||
*.jar binary
|
||||
@@ -1,86 +0,0 @@
|
||||
name: Build and Deploy
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
env:
|
||||
APP_NAME: delta-force-guide-server
|
||||
|
||||
jobs:
|
||||
build-and-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 21 (Corretto)
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 21
|
||||
distribution: corretto
|
||||
cache: gradle
|
||||
|
||||
- name: Build with Gradle
|
||||
run: >
|
||||
./gradlew bootJar -x test
|
||||
-PartefactVersion="${{ gitea.event.release.tag_name }}"
|
||||
-PbuildChannel=stable
|
||||
-Pvendor=${{ vars.VENDOR }}
|
||||
|
||||
- name: Resolve JAR file path
|
||||
id: jar
|
||||
run: |
|
||||
JAR_PATH=$(find build/libs -name '*.jar' | head -1)
|
||||
echo "file=$JAR_PATH" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload JAR to Gitea Release
|
||||
run: |
|
||||
TAG="${{ gitea.event.release.tag_name }}"
|
||||
FILE="${{ steps.jar.outputs.file }}"
|
||||
ASSET_NAME="${APP_NAME}-${TAG}.jar"
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
-H "Content-Type: multipart/form-data" \
|
||||
-F "attachment=@${FILE};filename=${ASSET_NAME}" \
|
||||
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${{ gitea.event.release.id }}/assets?name=${ASSET_NAME}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ vars.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
|
||||
- name: Generate image tags
|
||||
id: meta
|
||||
run: |
|
||||
DOCKERHUB_USER="${{ vars.DOCKER_HUB_USERNAME }}"
|
||||
echo "tag_version=${DOCKERHUB_USER}/${APP_NAME}:${{ gitea.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
|
||||
echo "tag_latest=${DOCKERHUB_USER}/${APP_NAME}:latest" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile.ci
|
||||
build-args: |
|
||||
JAR_FILE=${{ steps.jar.outputs.file }}
|
||||
IMAGE_VERSION=${{ gitea.event.release.tag_name }}
|
||||
IMAGE_VENDOR=${{ vars.VENDOR }}
|
||||
BUILD_DATE=${{ gitea.event.release.published_at }}
|
||||
push: true
|
||||
tags: |
|
||||
${{ steps.meta.outputs.tag_version }}
|
||||
${{ steps.meta.outputs.tag_latest }}
|
||||
|
||||
- name: Push README to Docker Hub
|
||||
uses: christian-korneck/update-container-description-action@v1
|
||||
env:
|
||||
DOCKER_USER: ${{ vars.DOCKER_HUB_USERNAME }}
|
||||
DOCKER_PASS: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
with:
|
||||
destination_container_repo: ${{ vars.DOCKER_HUB_USERNAME }}/${{ env.APP_NAME }}
|
||||
provider: dockerhub
|
||||
readme_file: README.md
|
||||
@@ -1,89 +0,0 @@
|
||||
name: Build and Deploy
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
env:
|
||||
APP_NAME: ahsarah-guide-server
|
||||
|
||||
jobs:
|
||||
build-and-release:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: server
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 21 (Corretto)
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 21
|
||||
distribution: corretto
|
||||
cache: gradle
|
||||
|
||||
- name: Build with Gradle
|
||||
run: >
|
||||
./gradlew bootJar -x test
|
||||
-PartefactVersion="${{ gitea.event.release.tag_name }}"
|
||||
-PbuildChannel=stable
|
||||
-Pvendor=${{ vars.VENDOR }}
|
||||
|
||||
- name: Resolve JAR file path
|
||||
id: jar
|
||||
run: |
|
||||
JAR_PATH=$(find build/libs -name '*.jar' | head -1)
|
||||
echo "file=$JAR_PATH" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload JAR to Gitea Release
|
||||
run: |
|
||||
TAG="${{ gitea.event.release.tag_name }}"
|
||||
FILE="${{ steps.jar.outputs.file }}"
|
||||
ASSET_NAME="${APP_NAME}-${TAG}.jar"
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
-H "Content-Type: multipart/form-data" \
|
||||
-F "attachment=@${FILE};filename=${ASSET_NAME}" \
|
||||
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${{ gitea.event.release.id }}/assets?name=${ASSET_NAME}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ vars.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
|
||||
- name: Generate image tags
|
||||
id: meta
|
||||
run: |
|
||||
DOCKERHUB_USER="${{ vars.DOCKER_HUB_USERNAME }}"
|
||||
echo "tag_version=${DOCKERHUB_USER}/${APP_NAME}:${{ gitea.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
|
||||
echo "tag_latest=${DOCKERHUB_USER}/${APP_NAME}:latest" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: server
|
||||
file: server/Dockerfile.ci
|
||||
build-args: |
|
||||
JAR_FILE=${{ steps.jar.outputs.file }}
|
||||
IMAGE_VERSION=${{ gitea.event.release.tag_name }}
|
||||
IMAGE_VENDOR=${{ vars.VENDOR }}
|
||||
BUILD_DATE=${{ gitea.event.release.published_at }}
|
||||
push: true
|
||||
tags: |
|
||||
${{ steps.meta.outputs.tag_version }}
|
||||
${{ steps.meta.outputs.tag_latest }}
|
||||
|
||||
- name: Push README to Docker Hub
|
||||
uses: christian-korneck/update-container-description-action@v1
|
||||
env:
|
||||
DOCKER_USER: ${{ vars.DOCKER_HUB_USERNAME }}
|
||||
DOCKER_PASS: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
with:
|
||||
destination_container_repo: ${{ vars.DOCKER_HUB_USERNAME }}/${{ env.APP_NAME }}
|
||||
provider: dockerhub
|
||||
readme_file: server/README.md
|
||||
@@ -1,115 +0,0 @@
|
||||
name: Build and Deploy
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build release archive
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: web
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: pnpm
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 11
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build release archive
|
||||
run: pnpm build:tar
|
||||
|
||||
- name: Clean up previous build artifacts on server
|
||||
uses: appleboy/ssh-action@v1.0.3
|
||||
with:
|
||||
host: ${{ vars.DEPLOY_HOST }}
|
||||
username: ${{ vars.DEPLOY_USER }}
|
||||
port: ${{ vars.DEPLOY_PORT }}
|
||||
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
command: rm -rf /tmp/dist.tar.gz /tmp/dist.tar.gz/
|
||||
|
||||
- name: Upload artifact to server
|
||||
uses: appleboy/scp-action@v0.1.7
|
||||
with:
|
||||
host: ${{ vars.DEPLOY_HOST }}
|
||||
username: ${{ vars.DEPLOY_USER }}
|
||||
port: ${{ vars.DEPLOY_PORT }}
|
||||
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
source: "dist.tar.gz"
|
||||
target: "/tmp/"
|
||||
|
||||
upload-release-asset:
|
||||
name: Upload to Gitea Release
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Download artifact from server
|
||||
env:
|
||||
DEPLOY_HOST: ${{ vars.DEPLOY_HOST }}
|
||||
DEPLOY_USER: ${{ vars.DEPLOY_USER }}
|
||||
DEPLOY_PORT: ${{ vars.DEPLOY_PORT }}
|
||||
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
run: |
|
||||
set -e
|
||||
SSH_DIR="${RUNNER_TEMP}/ssh"
|
||||
mkdir -p "$SSH_DIR"
|
||||
chmod 700 "$SSH_DIR"
|
||||
printf '%s\n' "$DEPLOY_SSH_KEY" > "$SSH_DIR/key"
|
||||
chmod 600 "$SSH_DIR/key"
|
||||
scp -i "$SSH_DIR/key" \
|
||||
-P "$DEPLOY_PORT" \
|
||||
-o StrictHostKeyChecking=accept-new \
|
||||
-o UserKnownHostsFile="$SSH_DIR/known_hosts" \
|
||||
"${DEPLOY_USER}@${DEPLOY_HOST}:/tmp/dist.tar.gz" \
|
||||
./dist.tar.gz
|
||||
rm -rf "$SSH_DIR"
|
||||
|
||||
- name: Upload release asset via Gitea API
|
||||
run: |
|
||||
set -e
|
||||
RELEASE_ID=$(jq -r '.release.id' "$GITEA_EVENT_PATH")
|
||||
URL="${GITEA_SERVER_URL}/api/v1/repos/${GITEA_REPOSITORY}/releases/${RELEASE_ID}/assets?name=dist.tar.gz"
|
||||
curl -fsSL \
|
||||
-X POST \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/gzip" \
|
||||
--data-binary "@dist.tar.gz" \
|
||||
"${URL}"
|
||||
|
||||
deploy-to-server:
|
||||
name: Deploy to onixbyte.cn
|
||||
needs: [build, upload-release-asset]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Extract archive and deploy
|
||||
uses: appleboy/ssh-action@v1.0.3
|
||||
with:
|
||||
host: ${{ vars.DEPLOY_HOST }}
|
||||
username: ${{ vars.DEPLOY_USER }}
|
||||
port: ${{ vars.DEPLOY_PORT }}
|
||||
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
script_stop: true
|
||||
script: |
|
||||
set -e
|
||||
DEPLOY_PATH="${{ vars.DEPLOY_PATH }}"
|
||||
mkdir -p "$DEPLOY_PATH"
|
||||
rm -rf "$DEPLOY_PATH"/*
|
||||
tar -xzf /tmp/dist.tar.gz -C "$DEPLOY_PATH" --strip-components=1
|
||||
chown -R caddy:caddy "$DEPLOY_PATH"
|
||||
rm -f /tmp/dist.tar.gz
|
||||
File renamed without changes.
@@ -0,0 +1,30 @@
|
||||
name: Upload Release Assets
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created] # 仅当创建 Release 之后触发
|
||||
|
||||
jobs:
|
||||
build-and-upload:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# 必须授予权限以允许 Action 修改 Release
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Create archive
|
||||
run: |
|
||||
TAG_NAME=${{ github.event.release.tag_name }}
|
||||
tar -czvf "website-dist-${TAG_NAME}.tar.gz" --exclude=".git*" --exclude=".github*" .
|
||||
|
||||
- name: Upload Release Asset
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
# 上传刚才生成的 tar.gz 文件
|
||||
files: dist-${{ github.event.release.tag_name }}.tar.gz
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
+87
-41
@@ -97,6 +97,29 @@ fabric.properties
|
||||
# Editor-based HTTP Client
|
||||
http-client.private.env.json
|
||||
|
||||
### Gradle
|
||||
.gradle
|
||||
**/build/
|
||||
!**/src/**/build/
|
||||
|
||||
# Ignore Gradle GUI config
|
||||
gradle-app.setting
|
||||
|
||||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||
!gradle-wrapper.jar
|
||||
|
||||
# Avoid ignore Gradle wrappper properties
|
||||
!gradle-wrapper.properties
|
||||
|
||||
# Cache of project
|
||||
.gradletasknamecache
|
||||
|
||||
# Eclipse Gradle plugin generated files
|
||||
# Eclipse Core
|
||||
.project
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
|
||||
### Java
|
||||
# Compiled class file
|
||||
*.class
|
||||
@@ -123,29 +146,10 @@ http-client.private.env.json
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
### Gradle
|
||||
.gradle
|
||||
**/build/
|
||||
!**/src/**/build/
|
||||
|
||||
!gradle/
|
||||
!gradle/wrapper
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
!gradle/wrapper/gradle-wrapper.properties
|
||||
gradle-app.setting
|
||||
.gradletasknamecache
|
||||
|
||||
# Eclipse Gradle plugin generated files
|
||||
# Eclipse Core
|
||||
.project
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
|
||||
gradle.properties
|
||||
|
||||
### Node.js
|
||||
# Logs
|
||||
logs
|
||||
#*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
@@ -160,6 +164,9 @@ pids
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
@@ -167,10 +174,25 @@ coverage
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
@@ -183,6 +205,9 @@ jspm_packages/
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
@@ -206,9 +231,45 @@ out
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Vite logs files
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
.temp
|
||||
#.cache
|
||||
|
||||
# Sveltekit cache directory
|
||||
.svelte-kit/
|
||||
|
||||
# vitepress build output
|
||||
**/.vitepress/dist
|
||||
|
||||
# vitepress cache directory
|
||||
**/.vitepress/cache
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# Firebase cache directory
|
||||
.firebase/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
@@ -222,21 +283,6 @@ vite.config.ts.timestamp-*
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
|
||||
### Server-specific
|
||||
# Config
|
||||
server/config/*.yml
|
||||
server/config/*.yaml
|
||||
server/config/*.properties
|
||||
|
||||
# Tests
|
||||
server/test/
|
||||
|
||||
# frp config
|
||||
frpc.toml
|
||||
|
||||
### Claude Code
|
||||
.claude/settings.local.json
|
||||
.claude/memory/
|
||||
.claude/plans/
|
||||
.claude/worktrees/
|
||||
.claude/scheduled_tasks.json
|
||||
# Vite logs files
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
File renamed without changes.
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"name": "pnpm dev",
|
||||
"command": "pnpm dev",
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
{
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"name": "build",
|
||||
"command": "pnpm build",
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Monorepo Structure
|
||||
|
||||
- `server/` — Java 21 + Spring Boot 3.5 + Gradle (Kotlin DSL) REST API backend
|
||||
- `web/` — React 19 + Vite 8 + TypeScript + Ant Design 6 + Tailwind CSS 4 frontend
|
||||
|
||||
## Server
|
||||
|
||||
### Coding Standards
|
||||
|
||||
- **Style**: Follow the Google Java Coding Style as the foundation.
|
||||
- **Indentation**: Use 4 spaces — no tabs.
|
||||
- **Line length**: Maximum 100 characters per line.
|
||||
- **Comments**: All code comments must use British English spelling (e.g. "colour" not "color", "behaviour" not "behavior", "serialise" not "serialize", "analyse" not "analyze", "traveller" not "traveler").
|
||||
|
||||
### Build & Test Commands
|
||||
|
||||
```bash
|
||||
cd server
|
||||
|
||||
# Build the project (skip tests)
|
||||
./gradlew build -x test
|
||||
|
||||
# Run all tests
|
||||
./gradlew test
|
||||
|
||||
# Run a single test class
|
||||
./gradlew test --tests "com.onixbyte.ahsarahguide.service.PasswordEncoderTest"
|
||||
|
||||
# Build the full JAR
|
||||
./gradlew bootJar
|
||||
```
|
||||
|
||||
The project uses Gradle with Java 21 (Amazon Corretto). Tests use JUnit 5 with the Spring Boot test framework, H2 in-memory database for test runtime, and Spring Security test support. Tests require an active `dev` profile.
|
||||
|
||||
### Code Architecture
|
||||
|
||||
**Ahsarah Guide Server** — A REST API backend for managing firearm builds/modifications.
|
||||
|
||||
### Package structure
|
||||
|
||||
```
|
||||
com.onixbyte.ahsarahguide
|
||||
├── client/ # External service clients (TokenClient for JWT)
|
||||
├── config/ # Spring beans: Security, CORS, Cache/Redis, Jackson, MyBatis, Spring Data
|
||||
├── controller/ # REST controllers (Firearm, Modification, Tag, Auth)
|
||||
├── domain/
|
||||
│ ├── converter/ # JPA attribute converters (FirearmTypeConverter)
|
||||
│ ├── dto/ # Request/response records (FirearmRequest, ModificationResponse, etc.)
|
||||
│ └── entity/ # JPA entities (Firearm, Modification, User, Accessory, Tuning)
|
||||
├── enumeration/ # Enums (FirearmType)
|
||||
├── exeption/ # BizException (custom runtime exception with HTTP status)
|
||||
├── filter/ # TokenAuthenticationFilter (JWT auth via OncePerRequestFilter)
|
||||
├── manager/ # Thin @Transactional wrappers around repositories
|
||||
├── mapper/ # MyBatis mappers (configured but currently unused)
|
||||
├── properties/ # @ConfigurationProperties records (Cors, Token, Cookie)
|
||||
├── repository/ # Spring Data JPA repositories
|
||||
├── security/
|
||||
│ ├── authentication/ # Custom UsernamePasswordAuthentication impl
|
||||
│ └── provider/ # UsernamePasswordAuthenticationProvider
|
||||
├── service/ # Business logic layer (FirearmService, ModificationService, AuthService, etc.)
|
||||
├── shared/ # Constants and utility classes (CookieName, CredentialProvider, JacksonModules)
|
||||
└── utils/ # Helpers (DateTimeUtil)
|
||||
```
|
||||
|
||||
### Key design decisions
|
||||
|
||||
- **JPA + native queries**: Most CRUD uses Spring Data JPA. Native queries (in `ModificationRepository`) handle JSONB tag filtering with Postgres `@>` operator.
|
||||
- **Custom auth flow**: JWT tokens in httpOnly cookies (`AccessToken`). Spring Security with a custom `UsernamePasswordAuthenticationProvider` and `TokenAuthenticationFilter`. Tokens are auto-renewed within 5 min of expiry.
|
||||
- **JSONB storage**: `Modification.tags` and `Modification.accessories` (including nested `Tuning` objects) are stored as JSONB columns using Hypersistence Utils `JsonType`.
|
||||
- **Strict layering**: The call chain must follow `Controller → Service → Manager → Repository/Mapper`. Skipping layers (e.g. Controller calling Manager directly, Service calling Repository directly) is not permitted.
|
||||
- **DTOs as Java records**: All request/response objects are immutable records with static `from()` factory methods for entity→DTO conversion.
|
||||
- **Flyway migrations**: SQL migrations in `src/main/resources/db/migration/`.
|
||||
|
||||
### API endpoints
|
||||
|
||||
| Path | Methods | Auth |
|
||||
|-------------------------------|------------------|--------------------------------------|
|
||||
| `/firearms` | GET, POST | GET public, POST requires auth |
|
||||
| `/firearms/{id}` | GET, PUT, DELETE | GET public, PUT/DELETE requires auth |
|
||||
| `/modifications` | GET, POST | GET public, POST requires auth |
|
||||
| `/modifications/{id}` | GET, PUT, DELETE | GET public, PUT/DELETE requires auth |
|
||||
| `/modifications/batch` | POST | Requires auth |
|
||||
| `/modifications/batch-delete` | DELETE | Requires auth |
|
||||
| `/tags` | GET | Public |
|
||||
| `/auth/login` | POST | Public |
|
||||
| `/auth/logout` | POST | Authenticated |
|
||||
|
||||
### Commit convention
|
||||
|
||||
Conventional commits: `feat:`, `chore:`, `fix:`. Messages are in English, present tense imperative style.
|
||||
|
||||
---
|
||||
|
||||
## Web
|
||||
|
||||
### Commands
|
||||
|
||||
```bash
|
||||
cd web
|
||||
|
||||
pnpm install # Install dependencies (pnpm required)
|
||||
pnpm dev # Start Vite dev server
|
||||
pnpm build # TypeScript check + Vite production build
|
||||
pnpm build:tar # Build + tar.gz archive (used by CI)
|
||||
pnpm preview # Preview production build locally
|
||||
pnpm lint # ESLint
|
||||
```
|
||||
|
||||
No test suite exists in this project.
|
||||
|
||||
### Architecture
|
||||
|
||||
Chinese-language SPA for browsing and managing Ahsarah Guide (阿萨拉向导). The frontend talks to the Spring Boot backend via REST APIs.
|
||||
|
||||
**App shell** (`src/main.tsx`): React 19 + React Router 7 + Redux Toolkit + Ant Design 6 + Tailwind CSS 4. Wraps the router in Redux `Provider` → `PersistGate` (Redux Persist) → Ant Design `StyleProvider`/`ConfigProvider` (locale `zh_CN`).
|
||||
|
||||
**Routing** (`src/router/index.tsx`): Two layout groups:
|
||||
- `HeroLayout` (nav header + footer) for `/`, `/firearms`, `/mod-codes`
|
||||
- `EmptyLayout` (minimal) for `/login`
|
||||
All page components are lazy-loaded via `createBrowserRouter` + `lazy()`.
|
||||
|
||||
**State** (`src/store/`): Redux Toolkit with two slices — `auth` (current user) and `firearms` (paginated firearm list). State is persisted to `localStorage` or `sessionStorage` based on the `VITE_REDUX_STORAGE` env var. Use typed hooks from `src/hooks/store.ts` (`useAppDispatch`, `useAppSelector`).
|
||||
|
||||
**API layer** (`src/api/`): Axios instance (`src/shared/web-client/`) with base URL from `VITE_API_BASE_URL`, 10s timeout, and credentials. API modules: `FirearmApi`, `ModificationApi`, `TagApi`, `AuthApi`.
|
||||
|
||||
**Pages**:
|
||||
- `FirearmsPage` — paginated card grid with type filter, create/edit modals (admin-only), delete with popconfirm
|
||||
- `ModCodesPage` — paginated list with tag multi-select and firearmId query param filter, create/edit modals with nested accessory/tuning form lists
|
||||
- `LoginPage` — simple username/password form, dispatches `setCurrentUser` on success
|
||||
|
||||
**Shared form components**: `FirearmForm` and `ModificationForm` are reused by both create and edit modals. `ModificationForm` fetches all firearms for its weapon selector and supports a `lockFirearmId` prop that disables the selector (used when navigating from a specific firearm).
|
||||
|
||||
**Type system** (`src/types/`): `Firearm` with weapon stats, `Modification` with nested `Accessory[]` → `Tuning[]`, `Page<T>` for paginated API responses, `User` for auth.
|
||||
|
||||
**Vite config**: Alias `@` → `./src`. Plugins: React, Tailwind CSS 4, port checker. Build uses rolldown with manual chunk splitting for React, Redux, Ant Design, React Router, and rc-* packages.
|
||||
|
||||
**Styling**: Tailwind CSS 4 with CSS layers (`theme, base, antd, components, utilities`). Responsive grid for mod code cards (1→2→3→4 columns). Prettier: 100 print width, no semicolons, double quotes, trailing commas ES5.
|
||||
|
||||
### Environment variables
|
||||
|
||||
```
|
||||
VITE_API_BASE_URL=/api # Backend API base URL
|
||||
VITE_REDUX_STORAGE=local # "local" or "session" for Redux persistence
|
||||
```
|
||||
|
||||
### Contributing conventions
|
||||
|
||||
- User-facing copy, documentation, and code comments in British English
|
||||
- Commit messages use `chore:` prefix for dependency updates (per Dependabot config)
|
||||
File renamed without changes.
@@ -1,6 +1,6 @@
|
||||
MIT Licence
|
||||
|
||||
Copyright (c) 2026 OnixByte
|
||||
Copyright (c) 2026 Zihlu Wang
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,38 +1,94 @@
|
||||
# Ahsarah Guide (阿萨拉向导)
|
||||
# Delta Force Firearm Modification Codes
|
||||
|
||||
Ahsarah Guide is a full-stack web application for browsing and managing firearm modification guides.
|
||||
Delta Force Firearm Modification Codes is a lightweight web app for browsing and filtering firearm modification codes for Delta Force.
|
||||
|
||||
## Monorepo Structure
|
||||
The site is built with Vite, React, TypeScript, Tailwind CSS, and React Router. It presents a searchable code library with filtering by weapon, mode, and tag, and includes quick copy support for each modification code.
|
||||
|
||||
| Directory | Stack | Description |
|
||||
|-----------|-------|-------------|
|
||||
| `server/` | Java 21 + Spring Boot 3.5 + Gradle | REST API backend |
|
||||
| `web/` | React 19 + Vite 8 + TypeScript + Ant Design 6 | Web frontend |
|
||||
## Features
|
||||
|
||||
## Quick Start
|
||||
- Browse a curated list of firearm modification codes.
|
||||
- Filter results by weapon, mode, and tag.
|
||||
- Copy modification codes directly from the interface.
|
||||
- Render large lists efficiently with window virtualisation.
|
||||
- Deploy as a static site.
|
||||
|
||||
### Server
|
||||
## Tech Stack
|
||||
|
||||
Prerequisites: JDK 21 (Amazon Corretto), PostgreSQL, Redis
|
||||
- Vite
|
||||
- React 19
|
||||
- TypeScript
|
||||
- Tailwind CSS 4
|
||||
- React Router 7
|
||||
- @tanstack/react-virtual
|
||||
- Day.js
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Node.js 20 or later is recommended.
|
||||
- pnpm is required for dependency management and scripts.
|
||||
|
||||
### Install dependencies
|
||||
|
||||
```bash
|
||||
cd server
|
||||
cp config/application-prod.yaml.example config/application-dev.yaml
|
||||
# Edit config/application-dev.yaml with your database and Redis credentials
|
||||
./gradlew bootJar
|
||||
java -jar build/libs/ahsarah-guide-server-*.jar
|
||||
pnpm install
|
||||
```
|
||||
|
||||
### Web
|
||||
|
||||
Prerequisites: Node.js 20+, pnpm
|
||||
### Start the development server
|
||||
|
||||
```bash
|
||||
cd web
|
||||
pnpm install
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
### Build for production
|
||||
|
||||
```bash
|
||||
pnpm build
|
||||
```
|
||||
|
||||
### Preview the production build locally
|
||||
|
||||
```bash
|
||||
pnpm preview
|
||||
```
|
||||
|
||||
## Available Scripts
|
||||
|
||||
- `pnpm dev`: start the Vite development server.
|
||||
- `pnpm build`: run TypeScript compilation and create a production build.
|
||||
- `pnpm preview`: preview the production bundle locally.
|
||||
- `pnpm lint`: run project linting.
|
||||
- `pnpm deploy`: build and publish the site with `gh-pages`.
|
||||
|
||||
## Project Structure
|
||||
|
||||
```text
|
||||
src/
|
||||
components/ Shared UI components
|
||||
layout/ Route layouts
|
||||
page/ Route pages
|
||||
router/ Router configuration
|
||||
```
|
||||
|
||||
The current dataset is stored in `src/data/modification-codes.json`.
|
||||
|
||||
## Deployment
|
||||
|
||||
The repository is configured for static deployment. The `public/CNAME` file indicates the site is intended to be served on `onixbyte.dev`.
|
||||
|
||||
To deploy:
|
||||
|
||||
```bash
|
||||
pnpm deploy
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome. If you want to improve the dataset, refine the filtering experience, or fix UI issues, open an issue or submit a pull request.
|
||||
|
||||
When contributing, please keep documentation and user-facing copy in British English.
|
||||
|
||||
## Licence
|
||||
|
||||
MIT. See [LICENCE](LICENCE) for details.
|
||||
This project is released under the MIT Licence. See `LICENCE` for details.
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/onixbyte.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>阿萨拉向导</title>
|
||||
<title>三角洲行动改枪码库</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
+95
-374
@@ -9,33 +9,29 @@
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"@ant-design/cssinjs": "^2.1.2",
|
||||
"@ant-design/icons": "^6.2.2",
|
||||
"@reduxjs/toolkit": "^2.11.2",
|
||||
"@tailwindcss/vite": "^4.2.4",
|
||||
"@tanstack/react-virtual": "^3.13.24",
|
||||
"antd": "^6.3.7",
|
||||
"axios": "^1.16.0",
|
||||
"axios": "^1.15.2",
|
||||
"dayjs": "^1.11.20",
|
||||
"react": "^19.2.6",
|
||||
"react-dom": "^19.2.6",
|
||||
"react": "^19.2.5",
|
||||
"react-dom": "^19.2.5",
|
||||
"react-redux": "^9.2.0",
|
||||
"react-router": "^7.15.0",
|
||||
"react-router-dom": "^7.15.0",
|
||||
"react-router": "^7.14.2",
|
||||
"react-router-dom": "^7.14.2",
|
||||
"redux-persist": "^6.0.0",
|
||||
"tailwindcss": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/typography": "^0.5.19",
|
||||
"@types/node": "^22.19.17",
|
||||
"@types/react": "^19.2.14",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^6.0.1",
|
||||
"globals": "^17.6.0",
|
||||
"globals": "^17.5.0",
|
||||
"prettier": "^3.8.3",
|
||||
"typescript": "~6.0.3",
|
||||
"vite": "^8.0.11",
|
||||
"vite-plugin-markdown": "^2.2.0",
|
||||
"vite-plugin-port-checker": "^1.0.1"
|
||||
"vite": "^8.0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@ant-design/colors": {
|
||||
@@ -247,9 +243,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@oxc-project/types": {
|
||||
"version": "0.132.0",
|
||||
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.132.0.tgz",
|
||||
"integrity": "sha512-FESMOxil5Se014ui/Eq8fT5uHJo6nIRwH0PfJrZJXs6Gek3ZVFOrpUv3YIZT20m+extU98Hg1Ym72U58rlsxUQ==",
|
||||
"version": "0.127.0",
|
||||
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.127.0.tgz",
|
||||
"integrity": "sha512-aIYXQBo4lCbO4z0R3FHeucQHpF46l2LbMdxRvqvuRuW2OxdnSkcng5B8+K12spgLDj93rtN3+J2Vac/TIO+ciQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/Boshen"
|
||||
@@ -995,9 +991,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-android-arm64": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.2.tgz",
|
||||
"integrity": "sha512-ZS4D1JPGn/MYQN/SYDWftIE/nVsM8j/AFOYEzAoOE2O3NktQOZru+/vYXGbR/qtdLdIfGCP0lcoJiYVzsEz+iQ==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-s70pVGhw4zqGeFnXWvAzJDlvxhlRollagdCCKRgOsgUOH3N1l0LIxf83AtGzmb5SiVM4Hjl5HyarMRfdfj3DaQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1011,9 +1007,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-darwin-arm64": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.2.tgz",
|
||||
"integrity": "sha512-vdFA9+C/rekyGce7WqHs/xoT0ioZEWaOFyZLIV1mEeNFaFDUQrPIo8Vs2GvJ6eetb3rzDUtUBgzto3ExpXJB3w==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-4ksWc9n0mhlZpZ9PMZgTGjeOPRu8MB1Z3Tz0Mo02eWfWCHMW1zN82Qz/pL/rC+yQa+8ZnutMF0JjJe7PjwasYw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1027,9 +1023,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-darwin-x64": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.2.tgz",
|
||||
"integrity": "sha512-BewSOwTHazv77DTYiAZXSqqKZ4KP/KonFisDMVU7PImxoWfB2aepnPhd2E4SWz3zDzYgDNbs6jBmTdgNnF02GA==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-SUSDOI6WwUVNcWxd02QEBjLdY1VPHvlEkw6T/8nYG322iYWCTxRb1vzk4E+mWWYehTp7ERibq54LSJGjmouOsw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1043,9 +1039,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-freebsd-x64": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.2.tgz",
|
||||
"integrity": "sha512-m41o7M0YWtUdqk61Tb+jnKb2rN++iRdIASlExkUoKfIAH30DOHCB8fVLzSUpbWHHU8esmEioY62PxzexE8MBuA==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-hwnz3nw9dbJ05EDO/PvcjaaewqqDy7Y1rn1UO81l8iIK1GjenME75dl16ajbvSSMfv66WXSRCYKIqfgq2KCfxw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1059,9 +1055,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-arm-gnueabihf": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.2.tgz",
|
||||
"integrity": "sha512-jcojB9H7W/jS29pMKWAK1N+fU99vXodHDTatS3b3y/XSOCiHo0kkA74pL3jJmkoQtYpOCxDvaKs1fo2Ij/1X5w==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-IS+W7epTcwANmFSQFrS1SivEXHtl1JtuQA9wlxrZTcNi6mx+FDOYrakGevvvTwgj2JvWiK8B29/qD9BELZPyXQ==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@@ -1075,9 +1071,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-arm64-gnu": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.2.tgz",
|
||||
"integrity": "sha512-1jn6qDU5iiOgFgygDzKUuKP0maTi0/f1+sBLgvij/76C77Nm3ts6ufz9Bjg5q5dduxiUIxtq86JIoBvo1xQ4Ig==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-e6usGaHKW5BMNZOymS1UcEYGowQMWcgZ71Z17Sl/h2+ZziNJ1a9n3Zvcz6LdRyIW5572wBCTH/Z+bKuZouGk9Q==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1091,9 +1087,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-arm64-musl": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.2.tgz",
|
||||
"integrity": "sha512-QVLO/czFMdoMFSqlX3bcswcJNm/23r+qoa/jgtmFc/qEp6/jXmIkDjF/XIo8dPfGaiwy1xfQn8o77L79GeXFgw==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-b/CgbwAJpmrRLp02RPfhbudf5tZnN9nsPWK82znefso832etkem8H7FSZwxrOI9djcdTP7U6YfNhbRnh7djErg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1107,9 +1103,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-ppc64-gnu": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.0.2.tgz",
|
||||
"integrity": "sha512-hgO5Abm0w5UL6FEa2iFnZqo2KlK7TQ5QhV5x09hujBf7t5KzHQ1VmfPuTpqRy/rNlSxua3eWH374xxiVrP+lcA==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-4EII1iNGRUN5WwGbF/kOh/EIkoDN9HsupgLQoXfY+D1oyJm7/F4t5PYU5n8SWZgG0FEwakyM8pGgwcBYruGTlA==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
@@ -1123,9 +1119,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-s390x-gnu": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.0.2.tgz",
|
||||
"integrity": "sha512-fy8rXxuYEu602abC8MUNaPjYLIFzReOaEIEMKMUa0rFEUxNpVXhs15KSSQ4qlqSaM7B6rcj9rDZgADh/IGDzLQ==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-AH8oq3XqQo4IibpVXvPeLDI5pzkpYn0WiZAfT05kFzoJ6tQNzwRdDYQ45M8I/gslbodRZwW8uxLhbSBbkv96rA==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
@@ -1139,9 +1135,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-x64-gnu": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.2.tgz",
|
||||
"integrity": "sha512-0+bOkiQ779+r1WpoHOWHqncvyySci0vKph+myNDYb+im6meJAzHQXay6oEgnkHuUGouM1LKTZwqKpBow6Kj7CQ==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-cLnjV3xfo7KslbU41Z7z8BH/E1y5mzUYzAqih1d1MDaIGZRCMqTijqLv76/P7fyHuvUcfGsIpqCdddbxLLK9rA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1155,9 +1151,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-x64-musl": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.2.tgz",
|
||||
"integrity": "sha512-mjSkrzZK5Qsl0a9d1JgILOiuZOSDTVdKENcSXBoqbzSrspLR/4/IRVDo5wd2GgZjNss/viBFJdeq+j7qH2nypw==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-0phclDw1spsL7dUB37sIARuis2tAgomCJXAHZlpt8PXZ4Ba0dRP1e+66lsRqrfhISeN9bEGNjQs+T/Fbd7oYGw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1171,9 +1167,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-openharmony-arm64": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.2.tgz",
|
||||
"integrity": "sha512-1v5vHasdfQAZoEHakBV72LIFAC9JjnymsiKxp+GEr/ma3+NJCPSaYK+qavInOovJkgwFrs7GccX2d6IgDA3Z5w==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-0ag/hEgXOwgw4t8QyQvUCxvEg+V0KBcA6YuOx9g0r02MprutRF5dyljgm3EmR02O292UX7UeS6HzWHAl6KgyhA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1187,9 +1183,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-wasm32-wasi": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.2.tgz",
|
||||
"integrity": "sha512-mb1VobWn6NheziTk5/WEaR6AKVbrwT5sOi6C7zk3gy/pD1qtJfU1j4PgTo2NJnOtbL9Dl3Aeei8w9jJ7qC2jZQ==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-LEXei6vo0E5wTGwpkJ4KoT3OZJRnglwldt5ziLzOlc6qqb55z4tWNq2A+PFqCJuvWWdP53CVhG1Z9NtToDPJrA==",
|
||||
"cpu": [
|
||||
"wasm32"
|
||||
],
|
||||
@@ -1205,9 +1201,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-win32-arm64-msvc": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.2.tgz",
|
||||
"integrity": "sha512-SqKonF56vA/L2yHwHYcEp2P34URpOZ7d1fS635cTkpDnUtEGdUbhI6NzsPdqeSWvAAeGDrxjWjNmibDIdFf9/A==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-gUmyzBl3SPMa6hrqFUth9sVfcLBlYsbMzBx5PlexMroZStgzGqlZ26pYG89rBb45Mnia+oil6YAIFeEWGWhoZA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1221,9 +1217,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-win32-x64-msvc": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.2.tgz",
|
||||
"integrity": "sha512-v7qRI7gXLRINcOGXt+7YmAZ6iFuyZVMIoXAxhd8oP+DR9dLfL9GfNIx7PLMxmhZdvq8waUJBQiWN9EKNy+TRBQ==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-3hkiolcUAvPB9FLb3UZdfjVVNWherN1f/skkGWJP/fgSQhYUZpSIRr0/I8ZK9TkF3F7kxvJAk0+IcKvPHk9qQg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1498,19 +1494,6 @@
|
||||
"node": ">= 20"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/typography": {
|
||||
"version": "0.5.19",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.19.tgz",
|
||||
"integrity": "sha512-w31dd8HOx3k9vPtcQh5QHP9GwKcgbMp87j58qi6xgiBnFFtKEAgCWnDw4qUT8aHwkCp8bKvb/KGKWWHedP0AAg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"postcss-selector-parser": "6.0.10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"tailwindcss": ">=3.0.0 || insiders || >=4.0.0-alpha.20 || >=4.0.0-beta.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/vite": {
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.2.4.tgz",
|
||||
@@ -1688,16 +1671,6 @@
|
||||
"react-dom": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"sprintf-js": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
@@ -1768,19 +1741,6 @@
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/cssesc": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
|
||||
"integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"cssesc": "bin/cssesc"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/csstype": {
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
|
||||
@@ -1811,65 +1771,6 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/dom-serializer": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz",
|
||||
"integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"domelementtype": "^2.0.1",
|
||||
"domhandler": "^4.2.0",
|
||||
"entities": "^2.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/domelementtype": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",
|
||||
"integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/fb55"
|
||||
}
|
||||
],
|
||||
"license": "BSD-2-Clause"
|
||||
},
|
||||
"node_modules/domhandler": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz",
|
||||
"integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"domelementtype": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/fb55/domhandler?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/domutils": {
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz",
|
||||
"integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"dom-serializer": "^1.0.1",
|
||||
"domelementtype": "^2.2.0",
|
||||
"domhandler": "^4.2.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/fb55/domutils?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
@@ -1897,16 +1798,6 @@
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/entities": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz",
|
||||
"integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"funding": {
|
||||
"url": "https://github.com/fb55/entities?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/es-define-property": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||
@@ -1952,20 +1843,6 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"bin": {
|
||||
"esparse": "bin/esparse.js",
|
||||
"esvalidate": "bin/esvalidate.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/fdir": {
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
|
||||
@@ -2019,16 +1896,6 @@
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/front-matter": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/front-matter/-/front-matter-4.0.2.tgz",
|
||||
"integrity": "sha512-I8ZuJ/qG92NWX8i5x1Y8qyj3vizhXS31OxjKDu3LKP+7/qBgfIKValiZIEwoVoJKUHlhWtYrktkxV1XsX+pPlg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"js-yaml": "^3.13.1"
|
||||
}
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||
@@ -2159,26 +2026,6 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/htmlparser2": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz",
|
||||
"integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
"https://github.com/fb55/htmlparser2?sponsor=1",
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/fb55"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"domelementtype": "^2.0.1",
|
||||
"domhandler": "^4.0.0",
|
||||
"domutils": "^2.5.2",
|
||||
"entities": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/immer": {
|
||||
"version": "11.1.6",
|
||||
"resolved": "https://registry.npmjs.org/immer/-/immer-11.1.6.tgz",
|
||||
@@ -2204,20 +2051,6 @@
|
||||
"jiti": "lib/jiti-cli.mjs"
|
||||
}
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "3.14.2",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz",
|
||||
"integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"argparse": "^1.0.7",
|
||||
"esprima": "^4.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"js-yaml": "bin/js-yaml.js"
|
||||
}
|
||||
},
|
||||
"node_modules/json2mq": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/json2mq/-/json2mq-0.2.0.tgz",
|
||||
@@ -2476,16 +2309,6 @@
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/linkify-it": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz",
|
||||
"integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"uc.micro": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/magic-string": {
|
||||
"version": "0.30.21",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
|
||||
@@ -2495,40 +2318,6 @@
|
||||
"@jridgewell/sourcemap-codec": "^1.5.5"
|
||||
}
|
||||
},
|
||||
"node_modules/markdown-it": {
|
||||
"version": "12.3.2",
|
||||
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz",
|
||||
"integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1",
|
||||
"entities": "~2.1.0",
|
||||
"linkify-it": "^3.0.1",
|
||||
"mdurl": "^1.0.1",
|
||||
"uc.micro": "^1.0.5"
|
||||
},
|
||||
"bin": {
|
||||
"markdown-it": "bin/markdown-it.js"
|
||||
}
|
||||
},
|
||||
"node_modules/markdown-it/node_modules/argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
|
||||
"dev": true,
|
||||
"license": "Python-2.0"
|
||||
},
|
||||
"node_modules/markdown-it/node_modules/entities": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz",
|
||||
"integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"funding": {
|
||||
"url": "https://github.com/fb55/entities?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
@@ -2538,13 +2327,6 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/mdurl": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
|
||||
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
@@ -2603,9 +2385,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.5.15",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz",
|
||||
"integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==",
|
||||
"version": "8.5.14",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.14.tgz",
|
||||
"integrity": "sha512-SoSL4+OSEtR99LHFZQiJLkT59C5B1amGO1NzTwj7TT1qCUgUO6hxOvzkOYxD+vMrXBM3XJIKzokoERdqQq/Zmg==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
@@ -2622,7 +2404,7 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.12",
|
||||
"nanoid": "^3.3.11",
|
||||
"picocolors": "^1.1.1",
|
||||
"source-map-js": "^1.2.1"
|
||||
},
|
||||
@@ -2630,20 +2412,6 @@
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/postcss-selector-parser": {
|
||||
"version": "6.0.10",
|
||||
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz",
|
||||
"integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cssesc": "^3.0.0",
|
||||
"util-deprecate": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "3.8.3",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.3.tgz",
|
||||
@@ -2670,24 +2438,24 @@
|
||||
}
|
||||
},
|
||||
"node_modules/react": {
|
||||
"version": "19.2.6",
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-19.2.6.tgz",
|
||||
"integrity": "sha512-sfWGGfavi0xr8Pg0sVsyHMAOziVYKgPLNrS7ig+ivMNb3wbCBw3KxtflsGBAwD3gYQlE/AEZsTLgToRrSCjb0Q==",
|
||||
"version": "19.2.5",
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-19.2.5.tgz",
|
||||
"integrity": "sha512-llUJLzz1zTUBrskt2pwZgLq59AemifIftw4aB7JxOqf1HY2FDaGDxgwpAPVzHU1kdWabH7FauP4i1oEeer2WCA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-dom": {
|
||||
"version": "19.2.6",
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.6.tgz",
|
||||
"integrity": "sha512-0prMI+hvBbPjsWnxDLxlCGyM8PN6UuWjEUCYmZhO67xIV9Xasa/r/vDnq+Xyq4Lo27g8QSbO5YzARu0D1Sps3g==",
|
||||
"version": "19.2.5",
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.5.tgz",
|
||||
"integrity": "sha512-J5bAZz+DXMMwW/wV3xzKke59Af6CHY7G4uYLN1OvBcKEsWOs4pQExj86BBKamxl/Ik5bx9whOrvBlSDfWzgSag==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"scheduler": "^0.27.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^19.2.6"
|
||||
"react": "^19.2.5"
|
||||
}
|
||||
},
|
||||
"node_modules/react-is": {
|
||||
@@ -2788,13 +2556,13 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/rolldown": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.2.tgz",
|
||||
"integrity": "sha512-oZx5zVDtVB44AW3eaifgDml1gWRDZGvjcfdxonE4swNPG98PrrXjaO/KrnUjzlMnztCCRVlUueA1kCXhARGk6g==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-ZrT53oAKrtA4+YtBWPQbtPOxIbVDbxT0orcYERKd63VJTF13zPcgXTvD4843L8pcsI7M6MErt8QtON6lrB9tyA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@oxc-project/types": "=0.132.0",
|
||||
"@rolldown/pluginutils": "^1.0.0"
|
||||
"@oxc-project/types": "=0.127.0",
|
||||
"@rolldown/pluginutils": "1.0.0-rc.17"
|
||||
},
|
||||
"bin": {
|
||||
"rolldown": "bin/cli.mjs"
|
||||
@@ -2803,27 +2571,27 @@
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rolldown/binding-android-arm64": "1.0.2",
|
||||
"@rolldown/binding-darwin-arm64": "1.0.2",
|
||||
"@rolldown/binding-darwin-x64": "1.0.2",
|
||||
"@rolldown/binding-freebsd-x64": "1.0.2",
|
||||
"@rolldown/binding-linux-arm-gnueabihf": "1.0.2",
|
||||
"@rolldown/binding-linux-arm64-gnu": "1.0.2",
|
||||
"@rolldown/binding-linux-arm64-musl": "1.0.2",
|
||||
"@rolldown/binding-linux-ppc64-gnu": "1.0.2",
|
||||
"@rolldown/binding-linux-s390x-gnu": "1.0.2",
|
||||
"@rolldown/binding-linux-x64-gnu": "1.0.2",
|
||||
"@rolldown/binding-linux-x64-musl": "1.0.2",
|
||||
"@rolldown/binding-openharmony-arm64": "1.0.2",
|
||||
"@rolldown/binding-wasm32-wasi": "1.0.2",
|
||||
"@rolldown/binding-win32-arm64-msvc": "1.0.2",
|
||||
"@rolldown/binding-win32-x64-msvc": "1.0.2"
|
||||
"@rolldown/binding-android-arm64": "1.0.0-rc.17",
|
||||
"@rolldown/binding-darwin-arm64": "1.0.0-rc.17",
|
||||
"@rolldown/binding-darwin-x64": "1.0.0-rc.17",
|
||||
"@rolldown/binding-freebsd-x64": "1.0.0-rc.17",
|
||||
"@rolldown/binding-linux-arm-gnueabihf": "1.0.0-rc.17",
|
||||
"@rolldown/binding-linux-arm64-gnu": "1.0.0-rc.17",
|
||||
"@rolldown/binding-linux-arm64-musl": "1.0.0-rc.17",
|
||||
"@rolldown/binding-linux-ppc64-gnu": "1.0.0-rc.17",
|
||||
"@rolldown/binding-linux-s390x-gnu": "1.0.0-rc.17",
|
||||
"@rolldown/binding-linux-x64-gnu": "1.0.0-rc.17",
|
||||
"@rolldown/binding-linux-x64-musl": "1.0.0-rc.17",
|
||||
"@rolldown/binding-openharmony-arm64": "1.0.0-rc.17",
|
||||
"@rolldown/binding-wasm32-wasi": "1.0.0-rc.17",
|
||||
"@rolldown/binding-win32-arm64-msvc": "1.0.0-rc.17",
|
||||
"@rolldown/binding-win32-x64-msvc": "1.0.0-rc.17"
|
||||
}
|
||||
},
|
||||
"node_modules/rolldown/node_modules/@rolldown/pluginutils": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz",
|
||||
"integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==",
|
||||
"version": "1.0.0-rc.17",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.17.tgz",
|
||||
"integrity": "sha512-n8iosDOt6Ig1UhJ2AYqoIhHWh/isz0xpicHTzpKBeotdVsTEcxsSA/i3EVM7gQAj0rU27OLAxCjzlj15IWY7bg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/scheduler": {
|
||||
@@ -2856,13 +2624,6 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/string-convert": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/string-convert/-/string-convert-0.2.1.tgz",
|
||||
@@ -2940,13 +2701,6 @@
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/uc.micro": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
|
||||
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "6.21.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
|
||||
@@ -2963,23 +2717,16 @@
|
||||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "8.0.14",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-8.0.14.tgz",
|
||||
"integrity": "sha512-s4BJJ+5y1pYL6Otw51FHhVJQhPnuRinKig64g/1+EUNaJsd3gCKdD31IPFvswUgW9/60QT9oFHbZHbQK5imcxw==",
|
||||
"version": "8.0.10",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-8.0.10.tgz",
|
||||
"integrity": "sha512-rZuUu9j6J5uotLDs+cAA4O5H4K1SfPliUlQwqa6YEwSrWDZzP4rhm00oJR5snMewjxF5V/K3D4kctsUTsIU9Mw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"lightningcss": "^1.32.0",
|
||||
"picomatch": "^4.0.4",
|
||||
"postcss": "^8.5.15",
|
||||
"rolldown": "1.0.2",
|
||||
"postcss": "^8.5.10",
|
||||
"rolldown": "1.0.0-rc.17",
|
||||
"tinyglobby": "^0.2.16"
|
||||
},
|
||||
"bin": {
|
||||
@@ -2996,7 +2743,7 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": "^20.19.0 || >=22.12.0",
|
||||
"@vitejs/devtools": "^0.1.18",
|
||||
"@vitejs/devtools": "^0.1.0",
|
||||
"esbuild": "^0.27.0 || ^0.28.0",
|
||||
"jiti": ">=1.21.0",
|
||||
"less": "^4.0.0",
|
||||
@@ -3046,32 +2793,6 @@
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-markdown": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/vite-plugin-markdown/-/vite-plugin-markdown-2.2.0.tgz",
|
||||
"integrity": "sha512-eH2tXMZcx3EHb5okd+/0VIyoR8Gp9pGe24UXitOOcGkzObbJ1vl48aGOAbakoT88FBdzC8MXNkMfBIB9VK0Ndg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"domhandler": "^4.0.0",
|
||||
"front-matter": "^4.0.0",
|
||||
"htmlparser2": "^6.0.0",
|
||||
"markdown-it": "^12.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vite": ">= 2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-port-checker": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/vite-plugin-port-checker/-/vite-plugin-port-checker-1.0.1.tgz",
|
||||
"integrity": "sha512-Mx/Pj5zyu4oak+SKGwQyRLGAvnp9zx0nqjCLhaJoGJeZk2t4EarZojTcHGG0gPMJWj9X6c0MIfzaZDslg80/GA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"vite": ">=3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "ahsarah-guide-web",
|
||||
"name": "delta-force-guide-web",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
Generated
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,6 +0,0 @@
|
||||
delta-force-guide-server.iml
|
||||
build/
|
||||
!.gitlab-ci.yml
|
||||
!build/libs/*.jar
|
||||
.idea/
|
||||
.gradle
|
||||
@@ -1,3 +0,0 @@
|
||||
/gradlew text eol=lf
|
||||
*.bat text eol=crlf
|
||||
*.jar binary
|
||||
@@ -1,86 +0,0 @@
|
||||
name: Build and Deploy
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
env:
|
||||
APP_NAME: delta-force-guide-server
|
||||
|
||||
jobs:
|
||||
build-and-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 21 (Corretto)
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 21
|
||||
distribution: corretto
|
||||
cache: gradle
|
||||
|
||||
- name: Build with Gradle
|
||||
run: >
|
||||
./gradlew bootJar -x test
|
||||
-PartefactVersion="${{ gitea.event.release.tag_name }}"
|
||||
-PbuildChannel=stable
|
||||
-Pvendor=${{ vars.VENDOR }}
|
||||
|
||||
- name: Resolve JAR file path
|
||||
id: jar
|
||||
run: |
|
||||
JAR_PATH=$(find build/libs -name '*.jar' | head -1)
|
||||
echo "file=$JAR_PATH" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload JAR to Gitea Release
|
||||
run: |
|
||||
TAG="${{ gitea.event.release.tag_name }}"
|
||||
FILE="${{ steps.jar.outputs.file }}"
|
||||
ASSET_NAME="${APP_NAME}-${TAG}.jar"
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
-H "Content-Type: multipart/form-data" \
|
||||
-F "attachment=@${FILE};filename=${ASSET_NAME}" \
|
||||
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${{ gitea.event.release.id }}/assets?name=${ASSET_NAME}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ vars.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
|
||||
- name: Generate image tags
|
||||
id: meta
|
||||
run: |
|
||||
DOCKERHUB_USER="${{ vars.DOCKER_HUB_USERNAME }}"
|
||||
echo "tag_version=${DOCKERHUB_USER}/${APP_NAME}:${{ gitea.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
|
||||
echo "tag_latest=${DOCKERHUB_USER}/${APP_NAME}:latest" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile.ci
|
||||
build-args: |
|
||||
JAR_FILE=${{ steps.jar.outputs.file }}
|
||||
IMAGE_VERSION=${{ gitea.event.release.tag_name }}
|
||||
IMAGE_VENDOR=${{ vars.VENDOR }}
|
||||
BUILD_DATE=${{ gitea.event.release.published_at }}
|
||||
push: true
|
||||
tags: |
|
||||
${{ steps.meta.outputs.tag_version }}
|
||||
${{ steps.meta.outputs.tag_latest }}
|
||||
|
||||
- name: Push README to Docker Hub
|
||||
uses: christian-korneck/update-container-description-action@v1
|
||||
env:
|
||||
DOCKER_USER: ${{ vars.DOCKER_HUB_USERNAME }}
|
||||
DOCKER_PASS: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
with:
|
||||
destination_container_repo: ${{ vars.DOCKER_HUB_USERNAME }}/${{ env.APP_NAME }}
|
||||
provider: dockerhub
|
||||
readme_file: README.md
|
||||
@@ -1,162 +0,0 @@
|
||||
### macOS
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
### Linux
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# Metadata left by Dolphin file manager, which comes with KDE Plasma
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
# Log files created by default by the nohup command
|
||||
nohup.out
|
||||
|
||||
### Windows
|
||||
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
### JetBrains IDE
|
||||
# Covers JetBrains IDEs: IntelliJ, GoLand, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based HTTP Client
|
||||
http-client.private.env.json
|
||||
|
||||
### Server
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
*.jar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
# Config
|
||||
config/*.yml
|
||||
config/*.yaml
|
||||
config/*.properties
|
||||
|
||||
# Tests
|
||||
test/
|
||||
|
||||
### Gradle
|
||||
.gradle
|
||||
**/build/
|
||||
!**/src/**/build/
|
||||
|
||||
!gradle/
|
||||
!gradle/wrapper
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
!gradle/wrapper/gradle-wrapper.properties
|
||||
gradle-app.setting
|
||||
.gradletasknamecache
|
||||
|
||||
### Claude Code
|
||||
.claude/settings.local.json
|
||||
.claude/memory/
|
||||
.claude/plans/
|
||||
.claude/worktrees/
|
||||
.claude/scheduled_tasks.json
|
||||
|
||||
# Eclipse Gradle plugin generated files
|
||||
# Eclipse Core
|
||||
.project
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
|
||||
gradle.properties
|
||||
|
||||
# frp config
|
||||
frpc.toml
|
||||
@@ -1,109 +0,0 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Coding Standards
|
||||
|
||||
- **Style**: Follow the Google Java Coding Style as the foundation.
|
||||
- **Indentation**: Use 4 spaces — no tabs.
|
||||
- **Line length**: Maximum 100 characters per line.
|
||||
- **Comments**: All code comments must use British English spelling (e.g. "colour" not "color", "behaviour" not "behavior", "serialise" not "serialize", "analyse" not "analyze", "traveller" not "traveler").
|
||||
|
||||
## Build & Test Commands
|
||||
|
||||
```bash
|
||||
# Build the project (skip tests)
|
||||
./gradlew build -x test
|
||||
|
||||
# Run all tests
|
||||
./gradlew test
|
||||
|
||||
# Run a single test class
|
||||
./gradlew test --tests "com.onixbyte.deltaforceguide.service.PasswordEncoderTest"
|
||||
|
||||
# Run a specific test method
|
||||
./gradlew test --tests "com.onixbyte.deltaforceguide.service.PasswordEncoderTest.generatePassword"
|
||||
|
||||
# Build the full JAR
|
||||
./gradlew bootJar
|
||||
```
|
||||
|
||||
The project uses Gradle with Java 21 (Amazon Corretto). Tests use JUnit 5 with the Spring Boot test framework, H2 in-memory database for test runtime, and Spring Security test support. Tests require an active `dev` profile.
|
||||
|
||||
## Code Architecture
|
||||
|
||||
**Delta Force Guide Server** — A REST API backend for managing Delta Force game firearm builds/modifications.
|
||||
|
||||
### Package structure
|
||||
|
||||
```
|
||||
com.onixbyte.deltaforceguide
|
||||
├── client/ # External service clients (TokenClient for JWT)
|
||||
├── config/ # Spring beans: Security, CORS, Cache/Redis, Jackson, MyBatis, Spring Data
|
||||
├── controller/ # REST controllers (Firearm, Modification, Tag, Auth)
|
||||
├── domain/
|
||||
│ ├── converter/ # JPA attribute converters (FirearmTypeConverter)
|
||||
│ ├── dto/ # Request/response records (FirearmRequest, ModificationResponse, etc.)
|
||||
│ └── entity/ # JPA entities (Firearm, Modification, User, Accessory, Tuning)
|
||||
├── enumeration/ # Enums (FirearmType)
|
||||
├── exeption/ # BizException (custom runtime exception with HTTP status)
|
||||
├── filter/ # TokenAuthenticationFilter (JWT auth via OncePerRequestFilter)
|
||||
├── manager/ # Thin @Transactional wrappers around repositories
|
||||
├── mapper/ # MyBatis mappers (configured but currently unused)
|
||||
├── properties/ # @ConfigurationProperties records (Cors, Token, Cookie)
|
||||
├── repository/ # Spring Data JPA repositories
|
||||
├── security/
|
||||
│ ├── authentication/ # Custom UsernamePasswordAuthentication impl
|
||||
│ └── provider/ # UsernamePasswordAuthenticationProvider
|
||||
├── service/ # Business logic layer (FirearmService, ModificationService, AuthService, etc.)
|
||||
├── shared/ # Constants and utility classes (CookieName, CredentialProvider, JacksonModules)
|
||||
└── utils/ # Helpers (DateTimeUtil)
|
||||
```
|
||||
|
||||
### Key design decisions
|
||||
|
||||
- **JPA + native queries**: Most CRUD uses Spring Data JPA. Native queries (in `ModificationRepository`) handle JSONB tag filtering with Postgres `@>` operator.
|
||||
- **Custom auth flow**: JWT tokens in httpOnly cookies (`AccessToken`). Spring Security with a custom `UsernamePasswordAuthenticationProvider` and `TokenAuthenticationFilter`. Tokens are auto-renewed within 5 min of expiry.
|
||||
- **JSONB storage**: `Modification.tags` and `Modification.accessories` (including nested `Tuning` objects) are stored as JSONB columns using Hypersistence Utils `JsonType`.
|
||||
- **Strict layering**: The call chain must follow `Controller → Service → Manager → Repository/Mapper`. Skipping layers (e.g. Controller calling Manager directly, Service calling Repository directly) is not permitted. Each layer has a distinct responsibility: Controller handles HTTP concerns, Service contains business logic, Manager manages `@Transactional` boundaries and data access coordination, Repository/Mapper handles raw data access.
|
||||
- **DTOs as Java records**: All request/response objects are immutable records with static `from()` factory methods for entity→DTO conversion.
|
||||
- **Flyway migrations**: SQL migrations in `src/main/resources/db/migration/` — V2 (init), V3 (bullet/damage fields), V4 (user), V5 (accessories JSONB column).
|
||||
|
||||
### Data model
|
||||
|
||||
- `firearm` table: id, name, type (int→FirearmType enum), level, calibre, fire_rate, armour_damage, body_damage, review
|
||||
- `modification` table: id, firearm_id (FK→firearm), name, code, tags (jsonb), accessories (jsonb), note, author, video_url
|
||||
- `app_user` table: id, username, email
|
||||
- `user_credential` table: user_id, provider, credential (hashed)
|
||||
|
||||
### API endpoints
|
||||
|
||||
| Path | Methods | Auth |
|
||||
|-------------------------------|------------------|--------------------------------------|
|
||||
| `/firearms` | GET, POST | GET public, POST requires auth |
|
||||
| `/firearms/{id}` | GET, PUT, DELETE | GET public, PUT/DELETE requires auth |
|
||||
| `/modifications` | GET, POST | GET public, POST requires auth |
|
||||
| `/modifications/{id}` | GET, PUT, DELETE | GET public, PUT/DELETE requires auth |
|
||||
| `/modifications/batch` | POST | Requires auth |
|
||||
| `/modifications/batch-delete` | DELETE | Requires auth |
|
||||
| `/tags` | GET | Public |
|
||||
| `/auth/login` | POST | Public |
|
||||
| `/auth/logout` | POST | Authenticated |
|
||||
|
||||
### Commit convention
|
||||
|
||||
Conventional commits: `feat:`, `chore:`, `fix:`. Messages are in English, present tense imperative style.
|
||||
|
||||
### External dependencies
|
||||
|
||||
- **DB**: PostgreSQL (via Flyway migrations), H2 in test
|
||||
- **Cache**: Redis (via Spring Cache + RedisTemplate with GenericJackson2JsonRedisSerializer)
|
||||
- **Auth**: java-jwt (auth0), BCrypt
|
||||
- **Docs**: springdoc-openapi (Swagger UI) on dev profile
|
||||
- **Onixbyte internal libs**: version-catalogue, tuple, common-toolbox, math-toolbox, identity-generator, captcha, regions
|
||||
- **AWS**: S3 SDK
|
||||
|
||||
### Profiles
|
||||
|
||||
- `dev`: Enables Swagger UI, connects to dev DB/Redis at `dfguide.onixbyte.cn`. Config in `config/application-dev.yaml`.
|
||||
- Default profile: Used for production, no Swagger, connects to production datasource.
|
||||
@@ -1,10 +0,0 @@
|
||||
FROM amazoncorretto:21 AS builder
|
||||
WORKDIR /app
|
||||
ADD . .
|
||||
RUN chmod +x ./gradlew && \
|
||||
./gradlew build -x test
|
||||
|
||||
FROM amazoncorretto:21-alpine AS runner
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/build/libs/ahsarah-guide-server-*.jar app.jar
|
||||
ENTRYPOINT ["java", "-jar", "app.jar"]
|
||||
@@ -1,19 +0,0 @@
|
||||
FROM amazoncorretto:21-alpine
|
||||
WORKDIR /app
|
||||
|
||||
ARG JAR_FILE
|
||||
ARG IMAGE_VERSION=dev
|
||||
ARG IMAGE_VENDOR=OnixByte
|
||||
ARG BUILD_DATE
|
||||
|
||||
COPY ${JAR_FILE} app.jar
|
||||
|
||||
LABEL org.opencontainers.image.title="ahsarah-guide-server" \
|
||||
org.opencontainers.image.description="REST API backend for Ahsarah Guide" \
|
||||
org.opencontainers.image.version="${IMAGE_VERSION}" \
|
||||
org.opencontainers.image.vendor="${IMAGE_VENDOR}" \
|
||||
org.opencontainers.image.source="https://onixbyte.dev/onixbyte/ahsarah-guide" \
|
||||
org.opencontainers.image.licenses="MIT" \
|
||||
org.opencontainers.image.created="${BUILD_DATE}"
|
||||
|
||||
ENTRYPOINT ["java", "-jar", "app.jar"]
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT Licence
|
||||
|
||||
Copyright (c) 2026 OnixByte
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,150 +0,0 @@
|
||||
# Delta Force Guide Server
|
||||
|
||||
REST API backend for managing **Delta Force** game firearm builds and modifications. Provides endpoints to browse, create, and share weapon configurations including attachments, tuning setups, tags, and build reviews.
|
||||
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Layer | Technology |
|
||||
|-----------|------------------------------------------------------------|
|
||||
| Language | Java 21 (Amazon Corretto) |
|
||||
| Framework | Spring Boot 3.x (Web, Security, Data JPA, Cache, Actuator) |
|
||||
| Build | Gradle (Kotlin DSL) |
|
||||
| Database | PostgreSQL (Flyway migrations, JSONB columns) |
|
||||
| Cache | Redis (2-hour TTL) |
|
||||
| Auth | Custom JWT via httpOnly cookies + BCrypt |
|
||||
| API Docs | springdoc-openapi (Swagger UI, dev profile only) |
|
||||
| Container | Multi-stage Docker image (Amazon Corretto 21 → Alpine) |
|
||||
| CI/CD | GitHub Actions — builds on release publish |
|
||||
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- JDK 21 (Amazon Corretto recommended)
|
||||
- PostgreSQL
|
||||
- Redis
|
||||
|
||||
### Configure
|
||||
|
||||
Copy and customise the development config:
|
||||
|
||||
```bash
|
||||
cp config/application-prod.yaml.example \
|
||||
config/application-dev.yaml
|
||||
```
|
||||
|
||||
Fill in your datasource and Redis connection details, then place the production config at `config/`, then enable it by environment variable `SPRING_PROFILES_ACTIVE`.
|
||||
|
||||
### Build
|
||||
|
||||
```bash
|
||||
# Compile (skip tests)
|
||||
./gradlew build -x test
|
||||
|
||||
# Run all tests
|
||||
./gradlew test
|
||||
|
||||
# Build executable JAR
|
||||
./gradlew bootJar
|
||||
```
|
||||
|
||||
### Run
|
||||
|
||||
```bash
|
||||
SPRING_PROFILES_ACTIVE=prod java -jar build/libs/delta-force-guide-server-$version.jar
|
||||
```
|
||||
|
||||
Swagger UI is available at `http://localhost:8080/swagger-ui.html` when the `dev` profile is active.
|
||||
|
||||
## Data Model
|
||||
|
||||
- **Firearm** — weapon base stats (name, type, level, calibre, fire rate, armour/body damage, review)
|
||||
- **Modification** — a build attached to a firearm, with name, code, tags (JSONB), accessories including nested tuning objects (JSONB), author notes, and video links
|
||||
- **App User** — registered user (username, email) with hashed credentials via BCrypt
|
||||
|
||||
Tags and accessories are stored as PostgreSQL JSONB columns using [Hypersistence Utils](https://github.com/vladmihalcea/hypersistence-utils), enabling flexible per-build metadata and filtering with the `@>` operator.
|
||||
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
Controller → Service → Manager → Repository / Mapper
|
||||
(HTTP) (logic) (@Transactional) (data access)
|
||||
```
|
||||
|
||||
The call chain is strictly enforced — skipping layers is not permitted. All request/response objects are Java records with static `from()` factory methods for entity-to-DTO conversion.
|
||||
|
||||
|
||||
## Docker
|
||||
|
||||
```bash
|
||||
# Build image
|
||||
docker pull registry.onixbyte.cn/onixbyte/delta-force-guide-server:latest
|
||||
|
||||
# Run container
|
||||
docker run -p 8080:8080 \
|
||||
-v /path/to/config:/app/config \
|
||||
-e SPRING_PROFILES_ACTIVE=$your_active_profiles
|
||||
delta-force-guide-server
|
||||
```
|
||||
|
||||
Pre-built images are published to **Self-hosted GitLab Container Registry** (`registry.onixbyte.cn/onixbyte/delta-force-guide-server`) on every release.
|
||||
|
||||
|
||||
## CI/CD
|
||||
|
||||
GitLab CI triggers on **tags**. The pipeline:
|
||||
|
||||
1. Builds the boot JAR with the release tag as the version
|
||||
2. Uploads the JAR as a release asset
|
||||
3. Builds and pushes a multi-arch Docker image to GHCR tagged with both `:latest` and `:<version>`
|
||||
|
||||
No tests are run in CI by design — tests are expected to pass locally before a release is cut.
|
||||
|
||||
|
||||
## Profiles
|
||||
|
||||
| Profile | Purpose |
|
||||
|---------|-----------------------------------------------------------------------|
|
||||
| `dev` | Enables Swagger UI, connects to dev DB/Redis at `dfguide.onixbyte.cn` |
|
||||
| default | Production mode, no Swagger, uses production datasource |
|
||||
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
src/main/java/com/onixbyte/deltaforceguide/
|
||||
├── client/ External service HTTP clients
|
||||
├── config/ Spring bean definitions (Security, CORS, Cache, Jackson, MyBatis)
|
||||
├── controller/ REST controllers
|
||||
├── domain/
|
||||
│ ├── converter/ JPA attribute converters
|
||||
│ ├── dto/ Request/response records
|
||||
│ └── entity/ JPA entities
|
||||
├── enumeration/ Enums (FirearmType)
|
||||
├── exception/ Custom BizException with HTTP status mapping
|
||||
├── filter/ TokenAuthenticationFilter (JWT through OncePerRequestFilter)
|
||||
├── manager/ @Transactional wrappers around repositories
|
||||
├── mapper/ MyBatis mapper interfaces (reserved for future use)
|
||||
├── properties/ @ConfigurationProperties records
|
||||
├── repository/ Spring Data JPA repositories
|
||||
├── security/
|
||||
│ ├── authentication/ Custom UsernamePasswordAuthentication
|
||||
│ └── provider/ UsernamePasswordAuthenticationProvider
|
||||
├── service/ Business logic
|
||||
├── shared/ Constants and utility classes
|
||||
└── utils/ General-purpose helpers
|
||||
```
|
||||
|
||||
|
||||
## Versioning
|
||||
|
||||
The application exposes its version at `/versions` (GET).
|
||||
|
||||
|
||||
## Licence
|
||||
|
||||
This project is licensed under the [MIT Licence](LICENCE). Copyright © 2026 OnixByte.
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
plugins {
|
||||
java
|
||||
alias(libs.plugins.spring.boot)
|
||||
alias(libs.plugins.spring.dependency.management)
|
||||
}
|
||||
|
||||
val artefactVersion: String by project
|
||||
val buildChannel: String by project
|
||||
val vendor: String by project
|
||||
|
||||
group = "com.onixbyte.ahsarahguide"
|
||||
version = artefactVersion
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// BOMs are imported as platforms, so they cannot be bundled.
|
||||
implementation(platform(libs.aws.sdk.bom))
|
||||
implementation(platform(libs.onixbyte.versionCatalogue))
|
||||
|
||||
implementation(libs.bundles.utilities)
|
||||
implementation(libs.bundles.onixbyte)
|
||||
implementation(libs.bundles.web)
|
||||
implementation(libs.bundles.persistence)
|
||||
implementation(libs.bundles.security)
|
||||
implementation(libs.bundles.cache)
|
||||
implementation(libs.bundles.observability)
|
||||
implementation(libs.bundles.mail)
|
||||
implementation(libs.bundles.aws)
|
||||
implementation(libs.bundles.docs)
|
||||
|
||||
// Annotation processor for @ConfigurationProperties; kept out of bundles.
|
||||
implementation(libs.spring.boot.configurationProcessor)
|
||||
|
||||
runtimeOnly(libs.postgres.driver)
|
||||
|
||||
testImplementation(libs.bundles.testing)
|
||||
testRuntimeOnly(libs.bundles.testRuntime)
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
filesMatching("application.yaml") {
|
||||
println("appVersion = ${artefactVersion}, channel = ${buildChannel}, vendor = ${vendor}")
|
||||
expand(
|
||||
"appVersion" to artefactVersion,
|
||||
"channel" to buildChannel,
|
||||
"vendor" to vendor
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
spring:
|
||||
datasource:
|
||||
# PostgreSQL connection URL.
|
||||
url: jdbc:postgresql://localhost:5432/dfguide_dev
|
||||
|
||||
# PostgreSQL username.
|
||||
username: postgres
|
||||
|
||||
# PostgreSQL password.
|
||||
password: 123456
|
||||
|
||||
# PostgreSQL JDBC driver class name.
|
||||
driver-class-name: org.postgresql.Driver
|
||||
data:
|
||||
redis:
|
||||
# Redis server host.
|
||||
host: localhost
|
||||
|
||||
# Redis server port.
|
||||
port: 6379
|
||||
|
||||
# Redis database index.
|
||||
#
|
||||
# Default to 0.
|
||||
database: 0
|
||||
|
||||
# Redis server password.
|
||||
#
|
||||
# Uncomment if the server requires a password.
|
||||
#
|
||||
# password: qwerty
|
||||
|
||||
logging:
|
||||
pattern:
|
||||
# Date format used in log output. Uncomment to use a custom format.
|
||||
#
|
||||
# Default to the date format provided by Spring Boot.
|
||||
# dateformat: dd MMM yyyy HH:mm:ss.SSS
|
||||
|
||||
app:
|
||||
cookie:
|
||||
# Whether the cookie is accessible from JavaScript. Keep `true` to mitigate XSS attacks.
|
||||
http-only: true
|
||||
|
||||
# Whether the cookie is only sent over HTTPS. Set to `true` in production is recommended.
|
||||
secure: true
|
||||
|
||||
# SameSite policy of the cookie.
|
||||
#
|
||||
# NOTE that `none` requires `secure` to be `true`.
|
||||
same-site: none
|
||||
|
||||
# Cookie path.
|
||||
path: '/'
|
||||
|
||||
# Cookie max age.
|
||||
max-age: P1D
|
||||
cors:
|
||||
# Cross-origin allowed origins. Add your custom origins here.
|
||||
allowed-origins: []
|
||||
|
||||
# Whether to allow credentials (cookies, authorisation headers) in cross-origin requests.
|
||||
#
|
||||
# Must be `true` since the application uses cookies for authentication. Change it only when
|
||||
# the authentication mechanism no longer relies on cookies.
|
||||
allow-credentials: true
|
||||
|
||||
# Whether to allow requests originating from private network addresses.
|
||||
allow-private-network: false
|
||||
|
||||
# Headers allowed in cross-origin requests.
|
||||
allowed-headers:
|
||||
- "Content-Type"
|
||||
- "Authorization"
|
||||
|
||||
# HTTP methods allowed in cross-origin requests.
|
||||
#
|
||||
# Methods are matched against Spring's HttpMethod, so they must be written in UPPER CASE.
|
||||
# e.g., GET, POST, PUT, PATCH, DELETE, OPTIONS
|
||||
allowed-methods:
|
||||
- GET
|
||||
- POST
|
||||
- PUT
|
||||
- PATCH
|
||||
- DELETE
|
||||
|
||||
# Response headers exposed to the browser in cross-origin responses.
|
||||
exposed-headers:
|
||||
- "Content-Type"
|
||||
- "Authorization"
|
||||
|
||||
# How long the CORS pre-flight response may be cached by the browser.
|
||||
#
|
||||
# Default to PT2H (2 hours).
|
||||
max-age: PT2H
|
||||
jwt:
|
||||
# Issuer identifier, domain name is recommended.
|
||||
issuer: ahsarah-guide.local
|
||||
|
||||
# Token signing secret, a 32-byte long or longer string is recommended.
|
||||
secret: qwertyuiopasdfghjklzxcvbnm123456
|
||||
|
||||
# Token valid duration.
|
||||
#
|
||||
# Default to PT2H (2 hours).
|
||||
valid-time: PT2H
|
||||
|
||||
# Token renew threshold.
|
||||
#
|
||||
# If valid time of this token is less than this value, then a new token will be delivered to
|
||||
# the user.
|
||||
#
|
||||
# Default to PT5M (5 min).
|
||||
renew-threshold: PT5M
|
||||
webhook:
|
||||
github:
|
||||
# GitHub webhook secret. Used to verify the signature of incoming webhook requests.
|
||||
secret: 123456
|
||||
|
||||
# GitHub usernames allowed to trigger webhook events.
|
||||
allowed-users: [ octocat, onixbyte ]
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
# Whether to expose the OpenAPI documentation. Set to `false` if you do not need it
|
||||
# (recommended in production mode).
|
||||
enabled: true
|
||||
swagger-ui:
|
||||
# Whether to expose the Swagger UI. Set to `false` if you do not need it
|
||||
# (recommended in production mode).
|
||||
enabled: true
|
||||
@@ -1,166 +0,0 @@
|
||||
[versions]
|
||||
jspecifyVersion = "1.0.0"
|
||||
javaJwtVersion = "4.5.1"
|
||||
postgresDriverVersion = "42.7.9"
|
||||
h2Version = "2.2.224"
|
||||
springBootVersion = "3.5.13"
|
||||
reactorVersion = "3.7.8"
|
||||
junitPlatformVersion = "1.12.2"
|
||||
onixbyteVersion = "3.4.0"
|
||||
onixbyteCaptcha = "1.1.0"
|
||||
onixbyteRegions = "2025.12.0"
|
||||
awsSdkVersion = "2.25.48"
|
||||
commonsIoVersion = "2.16.1"
|
||||
commonsCollections = "4.5.0"
|
||||
commonsLangVersion = "3.20.0"
|
||||
mybatisVersion = "3.0.5"
|
||||
jacksonVersion = "2.19.2"
|
||||
hypersistenceVersion = "3.14.0"
|
||||
springDependencyManagementVersion = "1.1.7"
|
||||
springDocVersion = "2.8.16"
|
||||
|
||||
[libraries]
|
||||
# General Utilities
|
||||
jspecify-core = { group = "org.jspecify", name = "jspecify", version.ref = "jspecifyVersion" }
|
||||
commons-io = { group = "commons-io", name = "commons-io", version.ref = "commonsIoVersion" }
|
||||
commons-collections = { group = "org.apache.commons", name = "commons-collections4", version.ref = "commonsCollections" }
|
||||
commons-lang = { group = "org.apache.commons", name = "commons-lang3", version.ref = "commonsLangVersion" }
|
||||
jackson-jsr310 = { group = "com.fasterxml.jackson.datatype", name = "jackson-datatype-jsr310", version.ref = "jacksonVersion" }
|
||||
|
||||
# Onixbyte Ecosystem
|
||||
onixbyte-versionCatalogue = { group = "com.onixbyte", name = "version-catalogue", version.ref = "onixbyteVersion" }
|
||||
onixbyte-tuple = { group = "com.onixbyte", name = "tuple" }
|
||||
onixbyte-commonToolbox = { group = "com.onixbyte", name = "common-toolbox" }
|
||||
onixbyte-cryptoToolbox = { group = "com.onixbyte", name = "crypto-toolbox", version.ref = "onixbyteVersion" }
|
||||
onixbyte-mathToolbox = { group = "com.onixbyte", name = "math-toolbox" }
|
||||
onixbyte-identityGenerator = { group = "com.onixbyte", name = "identity-generator" }
|
||||
onixbyte-captcha = { group = "com.onixbyte", name = "captcha", version.ref = "onixbyteCaptcha" }
|
||||
onixbyte-regions = { group = "com.onixbyte", name = "regions4j", version.ref = "onixbyteRegions" }
|
||||
|
||||
# Persistence & Database
|
||||
mybatis-starter-core = { group = "org.mybatis.spring.boot", name = "mybatis-spring-boot-starter", version.ref = "mybatisVersion" }
|
||||
spring-boot-starter-jpa = { group = "org.springframework.boot", name = "spring-boot-starter-data-jpa" }
|
||||
hypersistence-core = { group = "io.hypersistence", name = "hypersistence-utils-hibernate-63", version.ref = "hypersistenceVersion" }
|
||||
postgres-driver = { group = "org.postgresql", name = "postgresql", version.ref = "postgresDriverVersion" }
|
||||
h2-database = { group = "com.h2database", name = "h2", version.ref = "h2Version" }
|
||||
spring-boot-starter-redis = { group = "org.springframework.boot", name = "spring-boot-starter-data-redis", version.ref = "springBootVersion" }
|
||||
flyway-core = { group = "org.flywaydb", name = "flyway-core" }
|
||||
flyway-postgresql = { group = "org.flywaydb", name = "flyway-database-postgresql" }
|
||||
|
||||
# Spring Boot Core & Web
|
||||
spring-boot-starter-web = { group = "org.springframework.boot", name = "spring-boot-starter-web" }
|
||||
spring-boot-starter-webFlux = { group = "org.springframework.boot", name = "spring-boot-starter-webflux" }
|
||||
spring-boot-starter-validation = { group = "org.springframework.boot", name = "spring-boot-starter-validation" }
|
||||
spring-boot-starter-cache = { group = "org.springframework.boot", name = "spring-boot-starter-cache" }
|
||||
spring-boot-configurationProcessor = { group = "org.springframework.boot", name = "spring-boot-configuration-processor" }
|
||||
spring-boot-actuator = { group = "org.springframework.boot", name = "spring-boot-starter-actuator" }
|
||||
|
||||
# Security & Auth
|
||||
spring-boot-starter-security = { group = "org.springframework.boot", name = "spring-boot-starter-security" }
|
||||
jwt-core = { group = "com.auth0", name = "java-jwt", version.ref = "javaJwtVersion" }
|
||||
|
||||
# Java Mail & Templating
|
||||
spring-boot-starter-mail = { module = "org.springframework.boot:spring-boot-starter-mail" }
|
||||
spring-boot-starter-thymeleaf = { group = "org.springframework.boot", name = "spring-boot-starter-thymeleaf" }
|
||||
thymeleaf-extras-springsecurity6 = { group = "org.thymeleaf.extras", name = "thymeleaf-extras-springsecurity6" }
|
||||
|
||||
# Spring Doc
|
||||
spring-boot-starter-doc = { group = "org.springdoc", name = "springdoc-openapi-starter-webmvc-ui", version.ref = "springDocVersion" }
|
||||
|
||||
# Cloud Services
|
||||
aws-sdk-bom = { group = "software.amazon.awssdk", name = "bom", version.ref = "awsSdkVersion" }
|
||||
aws-sdk-s3 = { group = "software.amazon.awssdk", name = "s3" }
|
||||
|
||||
# Testing
|
||||
spring-boot-starter-test = { group = "org.springframework.boot", name = "spring-boot-starter-test", version.ref = "springBootVersion" }
|
||||
spring-security-test = { group = "org.springframework.security", name = "spring-security-test" }
|
||||
reactor-test = { group = "io.projectreactor", name = "reactor-test", version.ref = "reactorVersion" }
|
||||
junit-launcher = { group = "org.junit.platform", name = "junit-platform-launcher", version.ref = "junitPlatformVersion" }
|
||||
mybatis-starter-test = { group = "org.mybatis.spring.boot", name = "mybatis-spring-boot-starter-test", version.ref = "mybatisVersion" }
|
||||
|
||||
[bundles]
|
||||
# General utilities
|
||||
utilities = [
|
||||
"jspecify-core",
|
||||
"commons-io",
|
||||
"commons-lang",
|
||||
"commons-collections",
|
||||
"jackson-jsr310",
|
||||
]
|
||||
|
||||
# Onixbyte ecosystem (the version-catalogue BOM stays out of bundles, it is imported as a platform)
|
||||
onixbyte = [
|
||||
"onixbyte-tuple",
|
||||
"onixbyte-commonToolbox",
|
||||
"onixbyte-cryptoToolbox",
|
||||
"onixbyte-mathToolbox",
|
||||
"onixbyte-identityGenerator",
|
||||
"onixbyte-captcha",
|
||||
"onixbyte-regions",
|
||||
]
|
||||
|
||||
# Web layer
|
||||
web = [
|
||||
"spring-boot-starter-web",
|
||||
"spring-boot-starter-webFlux",
|
||||
"spring-boot-starter-validation",
|
||||
]
|
||||
|
||||
# Persistence and database
|
||||
persistence = [
|
||||
"spring-boot-starter-jpa",
|
||||
"mybatis-starter-core",
|
||||
"hypersistence-core",
|
||||
"flyway-core",
|
||||
"flyway-postgresql",
|
||||
]
|
||||
|
||||
# Security and authentication
|
||||
security = [
|
||||
"spring-boot-starter-security",
|
||||
"jwt-core",
|
||||
]
|
||||
|
||||
# Caching (Redis)
|
||||
cache = [
|
||||
"spring-boot-starter-redis",
|
||||
"spring-boot-starter-cache",
|
||||
]
|
||||
|
||||
# Observability
|
||||
observability = [
|
||||
"spring-boot-actuator",
|
||||
]
|
||||
|
||||
# Mail and templating
|
||||
mail = [
|
||||
"spring-boot-starter-mail",
|
||||
"spring-boot-starter-thymeleaf",
|
||||
"thymeleaf-extras-springsecurity6",
|
||||
]
|
||||
|
||||
# AWS cloud services
|
||||
aws = [
|
||||
"aws-sdk-s3",
|
||||
]
|
||||
|
||||
# API documentation
|
||||
docs = [
|
||||
"spring-boot-starter-doc",
|
||||
]
|
||||
|
||||
# Testing
|
||||
testing = [
|
||||
"spring-boot-starter-test",
|
||||
"spring-security-test",
|
||||
"reactor-test",
|
||||
"mybatis-starter-test",
|
||||
]
|
||||
testRuntime = [
|
||||
"h2-database",
|
||||
"junit-launcher",
|
||||
]
|
||||
|
||||
[plugins]
|
||||
spring-boot = { id = "org.springframework.boot", version.ref = "springBootVersion" }
|
||||
spring-dependency-management = { id = "io.spring.dependency-management", version.ref = "springDependencyManagementVersion" }
|
||||
BIN
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.4-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
Vendored
-251
@@ -1,251 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
-94
@@ -1,94 +0,0 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,14 +0,0 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "ahsarah-guide-server"
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
/**
|
||||
* Entry point for the Ahsarah Guide Server application.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@EnableAsync
|
||||
@SpringBootApplication
|
||||
public class AhsarahGuideApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AhsarahGuideApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.client;
|
||||
|
||||
import jakarta.mail.MessagingException;
|
||||
import jakarta.mail.internet.InternetAddress;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thymeleaf.TemplateEngine;
|
||||
import org.thymeleaf.context.Context;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class EmailClient {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(EmailClient.class);
|
||||
|
||||
private final JavaMailSender mailSender;
|
||||
|
||||
private final TemplateEngine emailTemplateEngine;
|
||||
|
||||
@Autowired
|
||||
public EmailClient(
|
||||
JavaMailSender mailSender,
|
||||
TemplateEngine emailTemplateEngine
|
||||
) {
|
||||
this.mailSender = mailSender;
|
||||
this.emailTemplateEngine = emailTemplateEngine;
|
||||
}
|
||||
|
||||
private String fromAddress;
|
||||
|
||||
@Autowired
|
||||
public void setFromAddress(@Value("${spring.mail.username}") String fromAddress) {
|
||||
this.fromAddress = fromAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a template-based HTML email asynchronously.
|
||||
*
|
||||
* @param toRecipient recipient email address
|
||||
* @param subject subject line
|
||||
* @param templateName template name (without .html extension, under mail-templates/)
|
||||
* @param variables context variables required by the template
|
||||
*/
|
||||
@Async
|
||||
public void sendTemplateMail(String toRecipient, String subject, String templateName, Map<String, Object> variables) {
|
||||
try {
|
||||
// Render HTML content using the dedicated email template engine
|
||||
var context = new Context();
|
||||
if (variables != null && !variables.isEmpty()) {
|
||||
context.setVariables(variables);
|
||||
}
|
||||
var htmlBody = emailTemplateEngine.process(templateName, context);
|
||||
|
||||
log.debug("htmlBody={}", htmlBody);
|
||||
|
||||
// Build the MIME message
|
||||
var message = mailSender.createMimeMessage();
|
||||
var helper = new MimeMessageHelper(
|
||||
message,
|
||||
MimeMessageHelper.MULTIPART_MODE_MIXED_RELATED,
|
||||
StandardCharsets.UTF_8.name()
|
||||
);
|
||||
|
||||
helper.setFrom(new InternetAddress(fromAddress, "阿萨拉向导", StandardCharsets.UTF_8.name()));
|
||||
helper.setTo(toRecipient);
|
||||
helper.setSubject(subject);
|
||||
helper.setText(htmlBody, true);
|
||||
|
||||
// Dispatch the message
|
||||
mailSender.send(message);
|
||||
log.info("Successfully dispatched email to: [{}] with subject: [{}]", toRecipient, subject);
|
||||
|
||||
} catch (MessagingException | UnsupportedEncodingException ex) {
|
||||
log.error("Failed to construct or send email to: [{}], subject: [{}]", toRecipient, subject, ex);
|
||||
// Handle or rethrow custom business exception if required
|
||||
} catch (Exception ex) {
|
||||
log.error("Unexpected error occurred while processing email for: [{}]", toRecipient, ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method specifically for sending registration/login verification codes.
|
||||
*
|
||||
* @param toRecipient target recipient email
|
||||
* @param username display username
|
||||
* @param code verification code string
|
||||
* @param expireMinutes expiration time in minutes
|
||||
*/
|
||||
@Async
|
||||
public void sendVerificationCode(String toRecipient, String username, String code, int expireMinutes) {
|
||||
var subject = "【阿萨拉向导】账号注册验证码";
|
||||
var variables = Map.<String, Object>of(
|
||||
"username", username,
|
||||
"code", code,
|
||||
"expireMinutes", expireMinutes
|
||||
);
|
||||
|
||||
sendTemplateMail(toRecipient, subject, "verification-code", variables);
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.client;
|
||||
|
||||
import com.auth0.jwt.JWT;
|
||||
import com.auth0.jwt.JWTVerifier;
|
||||
import com.auth0.jwt.algorithms.Algorithm;
|
||||
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||
import com.onixbyte.ahsarahguide.domain.entity.User;
|
||||
import com.onixbyte.ahsarahguide.properties.TokenProperties;
|
||||
import com.onixbyte.ahsarahguide.utils.DateTimeUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* Client for generating and verifying JSON Web Tokens using the Auth0 java-jwt library.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Component
|
||||
public class TokenClient {
|
||||
|
||||
private final Algorithm algorithm;
|
||||
private final TokenProperties tokenProperties;
|
||||
private final JWTVerifier verifier;
|
||||
|
||||
/**
|
||||
* Constructs a new TokenClient with the necessary algorithm and token properties.
|
||||
*
|
||||
* @param algorithm the signing algorithm used to secure the JWT
|
||||
* @param tokenProperties the configuration properties for the token, such as issuer and
|
||||
* validity period
|
||||
*/
|
||||
@Autowired
|
||||
public TokenClient(
|
||||
Algorithm algorithm,
|
||||
TokenProperties tokenProperties,
|
||||
JWTVerifier verifier
|
||||
) {
|
||||
this.algorithm = algorithm;
|
||||
this.tokenProperties = tokenProperties;
|
||||
this.verifier = verifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a JSON Web Token to the current user.
|
||||
*
|
||||
* @param user the current user for whom the token is being generated
|
||||
* @return a JWT string
|
||||
*/
|
||||
public String generateToken(User user) {
|
||||
var issuedAt = LocalDateTime.now();
|
||||
var expiresAt = issuedAt.plus(tokenProperties.validTime());
|
||||
|
||||
return JWT.create()
|
||||
.withSubject(user.getUsername())
|
||||
.withIssuer(tokenProperties.issuer())
|
||||
.withIssuedAt(DateTimeUtil.asInstant(issuedAt))
|
||||
.withExpiresAt(DateTimeUtil.asInstant(expiresAt))
|
||||
.sign(algorithm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify and decode token.
|
||||
*
|
||||
* @param token a JWT token
|
||||
* @return information included in the given token
|
||||
* @throws com.auth0.jwt.exceptions.JWTVerificationException if the token is invalid, such as
|
||||
* expired, or not signed by
|
||||
* specific server
|
||||
*/
|
||||
public DecodedJWT verifyToken(String token) {
|
||||
return verifier.verify(token);
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.config;
|
||||
|
||||
import com.onixbyte.ahsarahguide.interceptor.GitHubWebhookInterceptor;
|
||||
import com.onixbyte.ahsarahguide.interceptor.TrafficInterceptor;
|
||||
import com.onixbyte.ahsarahguide.properties.AppProperties;
|
||||
import com.onixbyte.ahsarahguide.security.resolver.CurrentUserArgumentResolver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(AppProperties.class)
|
||||
public class AppConfig implements WebMvcConfigurer {
|
||||
|
||||
private final TrafficInterceptor trafficInterceptor;
|
||||
|
||||
private final GitHubWebhookInterceptor gitHubWebhookInterceptor;
|
||||
|
||||
private final CurrentUserArgumentResolver currentUserArgumentResolver;
|
||||
|
||||
@Autowired
|
||||
public AppConfig(
|
||||
TrafficInterceptor trafficInterceptor,
|
||||
GitHubWebhookInterceptor gitHubWebhookInterceptor,
|
||||
CurrentUserArgumentResolver currentUserArgumentResolver
|
||||
) {
|
||||
this.trafficInterceptor = trafficInterceptor;
|
||||
this.gitHubWebhookInterceptor = gitHubWebhookInterceptor;
|
||||
this.currentUserArgumentResolver = currentUserArgumentResolver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(trafficInterceptor);
|
||||
registry.addInterceptor(gitHubWebhookInterceptor)
|
||||
.addPathPatterns("/webhooks/github");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
|
||||
resolvers.add(currentUserArgumentResolver);
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.config;
|
||||
|
||||
import com.onixbyte.ahsarahguide.shared.JacksonRedisSerialiser;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
||||
import org.springframework.data.redis.cache.RedisCacheManager;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.RedisSerializationContext;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
/**
|
||||
* Configuration class for Redis-based caching components.
|
||||
* <p>
|
||||
* This configuration class provides beans for Redis cache management and template operations
|
||||
* within the Helix application. It configures custom serialisation strategies using
|
||||
* {@link GenericJackson2JsonRedisSerializer} for values and string serialisation for keys,
|
||||
* ensuring optimal performance and compatibility with JSON-based data structures.
|
||||
* <p>
|
||||
* The configuration includes:
|
||||
* <ul>
|
||||
* <li>Custom {@link RedisCacheManager} with JSON serialisation support</li>
|
||||
* <li>Configured {@link RedisTemplate} for direct Redis operations</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author zihluwang
|
||||
* @see RedisCacheManager
|
||||
* @see RedisTemplate
|
||||
* @see GenericJackson2JsonRedisSerializer
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Configuration
|
||||
@EnableCaching
|
||||
public class CacheConfig {
|
||||
|
||||
/**
|
||||
* Creates a custom Redis cache manager with JSON serialisation support.
|
||||
* <p>
|
||||
* This method configures a {@link RedisCacheManager} that uses string serialisation for cache
|
||||
* keys and {@link GenericJackson2JsonRedisSerializer} for cache values. This setup ensures that
|
||||
* complex objects can be stored and retrieved from Redis cache whilst maintaining readability
|
||||
* and compatibility with JSON-based systems.
|
||||
*
|
||||
* @param connectionFactory the Redis connection factory used to establish connections
|
||||
* @return a configured {@link RedisCacheManager} with custom serialisation settings
|
||||
* @see RedisCacheManager
|
||||
* @see GenericJackson2JsonRedisSerializer
|
||||
* @see RedisSerializationContext
|
||||
*/
|
||||
@Bean
|
||||
public RedisCacheManager cacheManager(
|
||||
RedisConnectionFactory connectionFactory
|
||||
) {
|
||||
var _keySerializer = RedisSerializer.string();
|
||||
|
||||
var cacheConfiguration = RedisCacheConfiguration.defaultCacheConfig()
|
||||
.serializeKeysWith(RedisSerializationContext.SerializationPair
|
||||
.fromSerializer(_keySerializer))
|
||||
.serializeValuesWith(RedisSerializationContext.SerializationPair
|
||||
.fromSerializer(JacksonRedisSerialiser.INSTANCE))
|
||||
.entryTtl(Duration.ofMinutes(90L));
|
||||
|
||||
return RedisCacheManager.RedisCacheManagerBuilder
|
||||
.fromConnectionFactory(connectionFactory)
|
||||
.cacheDefaults(cacheConfiguration)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Redis template for direct Redis operations with custom serialisation.
|
||||
* <p>
|
||||
* This method configures a {@link RedisTemplate} that uses string serialisation for keys
|
||||
* and {@link GenericJackson2JsonRedisSerializer} for values. This template provides low-level
|
||||
* access to Redis operations whilst ensuring consistent serialisation strategies across
|
||||
* the application.
|
||||
* <p>
|
||||
* The template is fully configured and ready for use after bean creation.
|
||||
*
|
||||
* @param connectionFactory the Redis connection factory used to establish connections
|
||||
* @return a fully configured {@link RedisTemplate} for Redis operations
|
||||
* @see RedisTemplate
|
||||
* @see GenericJackson2JsonRedisSerializer
|
||||
* @see RedisSerializer
|
||||
*/
|
||||
@Bean
|
||||
public RedisTemplate<String, Object> redisTemplate(
|
||||
RedisConnectionFactory connectionFactory
|
||||
) {
|
||||
var redisTemplate = new RedisTemplate<String, Object>();
|
||||
redisTemplate.setConnectionFactory(connectionFactory);
|
||||
redisTemplate.setKeySerializer(RedisSerializer.string());
|
||||
redisTemplate.setValueSerializer(JacksonRedisSerialiser.INSTANCE);
|
||||
redisTemplate.afterPropertiesSet();
|
||||
return redisTemplate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.config;
|
||||
|
||||
import com.onixbyte.ahsarahguide.properties.CorsProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.CorsConfigurationSource;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Configuration for CORS (Cross-Origin Resource Sharing) policies.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties({CorsProperties.class})
|
||||
public class CorsConfig {
|
||||
|
||||
/**
|
||||
* Creates the CORS configuration source with properties from configuration.
|
||||
*
|
||||
* @param properties the CORS configuration properties
|
||||
* @return the CORS configuration source
|
||||
*/
|
||||
@Bean
|
||||
public CorsConfigurationSource corsConfigurationSource(
|
||||
CorsProperties properties
|
||||
) {
|
||||
var corsConfiguration = new CorsConfiguration();
|
||||
corsConfiguration.setAllowCredentials(properties.allowCredentials());
|
||||
corsConfiguration.setAllowedOrigins(List.of(properties.allowedOrigins()));
|
||||
corsConfiguration.setAllowedHeaders(List.of(properties.allowedHeaders()));
|
||||
corsConfiguration.setAllowedMethods(Stream.of(properties.allowedMethods())
|
||||
.map(HttpMethod::name)
|
||||
.toList());
|
||||
corsConfiguration.setMaxAge(properties.maxAge());
|
||||
corsConfiguration.setAllowPrivateNetwork(properties.allowPrivateNetwork());
|
||||
corsConfiguration.setExposedHeaders(List.of(properties.exposedHeaders()));
|
||||
|
||||
var corsConfigurationSource = new UrlBasedCorsConfigurationSource();
|
||||
corsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);
|
||||
return corsConfigurationSource;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.config;
|
||||
|
||||
import com.onixbyte.captcha.text.TextProducer;
|
||||
import com.onixbyte.captcha.text.impl.DefaultTextProducer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.thymeleaf.TemplateEngine;
|
||||
import org.thymeleaf.spring6.SpringTemplateEngine;
|
||||
import org.thymeleaf.templatemode.TemplateMode;
|
||||
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
|
||||
import org.thymeleaf.templateresolver.ITemplateResolver;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@Configuration
|
||||
public class EmailTemplateConfig {
|
||||
|
||||
@Bean
|
||||
public TemplateEngine emailTemplateEngine() {
|
||||
var resolver = new ClassLoaderTemplateResolver();
|
||||
// Template files are located under src/main/resources/mail-templates/
|
||||
resolver.setPrefix("mail-templates/");
|
||||
resolver.setSuffix(".html");
|
||||
resolver.setTemplateMode(TemplateMode.HTML);
|
||||
resolver.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
||||
resolver.setCacheable(true); // Enable caching for the production environment
|
||||
|
||||
var templateEngine = new SpringTemplateEngine();
|
||||
templateEngine.addTemplateResolver(resolver);
|
||||
return templateEngine;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TextProducer textProducer() {
|
||||
return DefaultTextProducer.builder().build();
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.config;
|
||||
|
||||
import com.onixbyte.ahsarahguide.filter.WebhookFilter;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class FilterConfig {
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean<WebhookFilter> webhookFilterBean(WebhookFilter webhookFilter) {
|
||||
var registrationBean = new FilterRegistrationBean<WebhookFilter>();
|
||||
|
||||
registrationBean.setFilter(webhookFilter);
|
||||
registrationBean.addUrlPatterns("/webhooks/*");
|
||||
registrationBean.setOrder(1);
|
||||
|
||||
return registrationBean;
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.onixbyte.ahsarahguide.shared.JacksonModules;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Configuration for Jackson JSON serialisation and deserialisation settings.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Configuration
|
||||
public class JacksonConfig {
|
||||
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer jacksonCustomiser() {
|
||||
return (builder) -> {
|
||||
builder.modules(JacksonModules.DATE_TIME_MODULE);
|
||||
builder.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.config;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Configuration for MyBatis SQL mapping framework integration.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Configuration
|
||||
@MapperScan(basePackages = {"com.onixbyte.ahsarahguide.mapper"})
|
||||
public class MyBatisConfig {
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.config;
|
||||
|
||||
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
|
||||
import io.swagger.v3.oas.annotations.info.Contact;
|
||||
import io.swagger.v3.oas.annotations.info.Info;
|
||||
import io.swagger.v3.oas.annotations.info.License;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@OpenAPIDefinition(
|
||||
info = @Info(
|
||||
title = "Ahsarah Guide Server",
|
||||
description = "API for Ahsarah Guide",
|
||||
version = "1.4.0",
|
||||
contact = @Contact(
|
||||
name = "Zihlu Wang",
|
||||
email = "zihlu.wang@onixbyte.com"
|
||||
),
|
||||
license = @License(
|
||||
name = "MIT",
|
||||
url = "https://onixbyte.dev/onixbyte/ahsarah-guide/raw/branch/main/LICENCE"
|
||||
)
|
||||
)
|
||||
)
|
||||
@Configuration
|
||||
public class OpenApiConfiguration {
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.config;
|
||||
|
||||
import com.auth0.jwt.JWT;
|
||||
import com.auth0.jwt.JWTVerifier;
|
||||
import com.auth0.jwt.algorithms.Algorithm;
|
||||
import com.onixbyte.ahsarahguide.exeption.ForbiddenException;
|
||||
import com.onixbyte.ahsarahguide.exeption.UnauthorisedException;
|
||||
import com.onixbyte.ahsarahguide.filter.TokenAuthenticationFilter;
|
||||
import com.onixbyte.ahsarahguide.properties.CookieProperties;
|
||||
import com.onixbyte.ahsarahguide.properties.TokenProperties;
|
||||
import com.onixbyte.ahsarahguide.security.provider.UsernamePasswordAuthenticationProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.ProviderManager;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.access.ExceptionTranslationFilter;
|
||||
import org.springframework.web.cors.CorsConfigurationSource;
|
||||
|
||||
/**
|
||||
* Spring Security configuration defining authentication, authorisation, and filter chains.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@EnableMethodSecurity
|
||||
@EnableConfigurationProperties({TokenProperties.class, CookieProperties.class})
|
||||
public class SecurityConfig {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SecurityConfig.class);
|
||||
|
||||
/**
|
||||
* Configures the HTTP security filter chain including endpoint authorisation and JWT filter.
|
||||
*
|
||||
* @param httpSecurity the HTTP security builder
|
||||
* @return the configured security filter chain
|
||||
*/
|
||||
@Bean
|
||||
public SecurityFilterChain securityFilterChain(
|
||||
HttpSecurity httpSecurity,
|
||||
CorsConfigurationSource corsConfigurationSource,
|
||||
TokenAuthenticationFilter tokenAuthenticationFilter
|
||||
) throws Exception {
|
||||
return httpSecurity
|
||||
.cors((cors) -> cors
|
||||
.configurationSource(corsConfigurationSource))
|
||||
.csrf(AbstractHttpConfigurer::disable)
|
||||
.sessionManagement((customiser) -> customiser
|
||||
.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||
.authorizeHttpRequests((customiser) -> customiser
|
||||
.anyRequest().permitAll()
|
||||
)
|
||||
.exceptionHandling(customiser -> customiser
|
||||
.authenticationEntryPoint((request, response, authException) -> {
|
||||
log.error("Unauthenticated request: {}", request, authException);
|
||||
throw new UnauthorisedException("请先登录");
|
||||
})
|
||||
.accessDeniedHandler((request, response, accessDeniedException) -> {
|
||||
log.error("Denied request: {}", request, accessDeniedException);
|
||||
throw new ForbiddenException("权限不足");
|
||||
})
|
||||
)
|
||||
.addFilterAfter(tokenAuthenticationFilter, ExceptionTranslationFilter.class)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the BCrypt password encoder for credential hashing.
|
||||
*
|
||||
* @return the BCrypt password encoder
|
||||
*/
|
||||
@Bean
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the authentication manager for the security configuration.
|
||||
*
|
||||
* @return the authentication manager
|
||||
*/
|
||||
@Bean
|
||||
public AuthenticationManager authenticationManager(
|
||||
UsernamePasswordAuthenticationProvider usernamePasswordAuthenticationProvider
|
||||
) {
|
||||
return new ProviderManager(
|
||||
usernamePasswordAuthenticationProvider
|
||||
);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Algorithm algorithm(TokenProperties properties) {
|
||||
return Algorithm.HMAC256(properties.secret());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JWTVerifier verifier(Algorithm algorithm, TokenProperties tokenProperties) {
|
||||
return JWT.require(algorithm)
|
||||
.withIssuer(tokenProperties.issuer())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
|
||||
/**
|
||||
* Configuration for Spring Data JPA auditing and repository settings.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Configuration
|
||||
@EnableJpaRepositories(basePackages = {"com.onixbyte.ahsarahguide.repository"})
|
||||
public class SpringDataConfig {
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.config;
|
||||
|
||||
import com.onixbyte.ahsarahguide.properties.GitHubWebhookProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties({GitHubWebhookProperties.class})
|
||||
public class WebhookConfig {
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.controller;
|
||||
|
||||
import com.onixbyte.ahsarahguide.domain.dto.ManageRoleRequest;
|
||||
import com.onixbyte.ahsarahguide.security.annotation.RequiresAuth;
|
||||
import com.onixbyte.ahsarahguide.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* REST controller for administrative user and role management.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Tag(name = "管理员", description = "管理员用户与角色管理")
|
||||
@RestController
|
||||
@RequestMapping("/admin")
|
||||
@Validated
|
||||
@RequiresAuth
|
||||
public class AdminController {
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
public AdminController(UserService userService) {
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
@Operation(description = "为用户分配角色(仅超级管理员可操作)")
|
||||
@PreAuthorize("hasRole('SUPER_USER')")
|
||||
@PutMapping("/users/{id}/roles")
|
||||
public ResponseEntity<Void> assignRole(
|
||||
@PathVariable @Positive(message = "用户ID必须为正数") Long id,
|
||||
@Valid @RequestBody ManageRoleRequest request
|
||||
) {
|
||||
userService.assignRole(id, request.role());
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Operation(description = "移除用户角色(仅超级管理员可操作)")
|
||||
@PreAuthorize("hasRole('SUPER_USER')")
|
||||
@DeleteMapping("/users/{id}/roles/{role}")
|
||||
public ResponseEntity<Void> removeRole(
|
||||
@PathVariable @Positive(message = "用户ID必须为正数") Long id,
|
||||
@PathVariable String role
|
||||
) {
|
||||
userService.removeRole(id, role);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.controller;
|
||||
|
||||
import com.onixbyte.ahsarahguide.domain.dto.*;
|
||||
import com.onixbyte.ahsarahguide.security.annotation.RequiresAuth;
|
||||
import com.onixbyte.ahsarahguide.service.AuthService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* REST controller for user authentication endpoints (login, logout).
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Tag(name = "用户鉴权", description = "处理用户登录与退出功能")
|
||||
@RestController
|
||||
@RequestMapping("/auth")
|
||||
public class AuthController {
|
||||
|
||||
private final AuthService authService;
|
||||
|
||||
public AuthController(AuthService authService) {
|
||||
this.authService = authService;
|
||||
}
|
||||
|
||||
@Operation(description = "用户登录")
|
||||
@PostMapping("/login")
|
||||
public ResponseEntity<UserResponse> login(@Validated @RequestBody LoginRequest request) {
|
||||
var user = authService.login(request);
|
||||
return authService.getUserResponseResponseEntity(user);
|
||||
}
|
||||
|
||||
@RequiresAuth
|
||||
@Operation(description = "退出登录")
|
||||
@PostMapping("/logout")
|
||||
public ResponseEntity<Void> logout() {
|
||||
var expiredCookie = authService.logout();
|
||||
return ResponseEntity.noContent()
|
||||
.header(HttpHeaders.SET_COOKIE, expiredCookie.toString())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Operation(description = "发送邮件验证码")
|
||||
@PostMapping("/verification-code")
|
||||
public SendVerificationCodeResponse sendVerificationCode(@Validated @RequestBody SendVerificationCodeRequest request) {
|
||||
var verificationCodeId = authService.sendVerificationCode(request);
|
||||
return new SendVerificationCodeResponse(verificationCodeId);
|
||||
}
|
||||
|
||||
@Operation(description = "用户注册")
|
||||
@PostMapping("/register")
|
||||
public ResponseEntity<UserResponse> register(@Validated @RequestBody RegisterRequest request) {
|
||||
var user = authService.register(request);
|
||||
return authService.getUserResponseResponseEntity(user);
|
||||
}
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.controller;
|
||||
|
||||
import com.onixbyte.ahsarahguide.domain.dto.DailyPasswordResponse;
|
||||
import com.onixbyte.ahsarahguide.service.DailyPasswordService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* REST controller for retrieving daily-generated passwords.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Tag(name = "每日密码", description = "获取每日密码信息")
|
||||
@RestController
|
||||
@RequestMapping("/daily-passwords")
|
||||
public class DailyPasswordController {
|
||||
|
||||
private final DailyPasswordService dailyPasswordService;
|
||||
|
||||
public DailyPasswordController(DailyPasswordService dailyPasswordService) {
|
||||
this.dailyPasswordService = dailyPasswordService;
|
||||
}
|
||||
|
||||
@Operation(description = "获取当日的每日密码数据,该数据将被缓存一天")
|
||||
@GetMapping
|
||||
public DailyPasswordResponse getDailyPassword() {
|
||||
return dailyPasswordService.getDailyPassword();
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.controller;
|
||||
|
||||
import com.onixbyte.ahsarahguide.domain.dto.FirearmRequest;
|
||||
import com.onixbyte.ahsarahguide.domain.dto.FirearmResponse;
|
||||
import com.onixbyte.ahsarahguide.domain.dto.PageResponse;
|
||||
import com.onixbyte.ahsarahguide.enumeration.FirearmType;
|
||||
import com.onixbyte.ahsarahguide.security.annotation.RequiresAuth;
|
||||
import com.onixbyte.ahsarahguide.service.FirearmService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* REST controller for firearm CRUD operations.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Tag(name = "武器管理", description = "与武器有关的操作")
|
||||
@RestController
|
||||
@RequestMapping("/firearms")
|
||||
public class FirearmController {
|
||||
|
||||
private final FirearmService firearmService;
|
||||
|
||||
public FirearmController(FirearmService firearmService) {
|
||||
this.firearmService = firearmService;
|
||||
}
|
||||
|
||||
@Operation(description = "获取分页武器数据")
|
||||
@Validated
|
||||
@GetMapping
|
||||
public PageResponse<FirearmResponse> pageQuery(
|
||||
@RequestParam(defaultValue = "0") @Min(0) int page,
|
||||
@RequestParam(defaultValue = "20") @Min(1) @Max(100) int size,
|
||||
@RequestParam(defaultValue = "id") String sortBy,
|
||||
@RequestParam(defaultValue = "DESC") Sort.Direction direction,
|
||||
@RequestParam(required = false) FirearmType type
|
||||
) {
|
||||
return firearmService.pageQuery(type, PageRequest.of(page, size, Sort.by(direction, sortBy)));
|
||||
}
|
||||
|
||||
@Operation(description = "获取指定武器的数据")
|
||||
@GetMapping("/{id}")
|
||||
public FirearmResponse queryById(@PathVariable Long id) {
|
||||
return firearmService.queryById(id);
|
||||
}
|
||||
|
||||
@RequiresAuth
|
||||
@PostMapping
|
||||
public FirearmResponse addFirearm(@Validated @RequestBody FirearmRequest request) {
|
||||
return firearmService.addFirearm(request);
|
||||
}
|
||||
|
||||
@RequiresAuth
|
||||
@Operation(description = "更新指定武器的数据")
|
||||
@PutMapping("/{id}")
|
||||
public FirearmResponse updateFirearm(@PathVariable Long id, @Validated @RequestBody FirearmRequest request) {
|
||||
return firearmService.updateFirearm(id, request);
|
||||
}
|
||||
|
||||
@RequiresAuth
|
||||
@Operation(description = "删除指定武器的数据")
|
||||
@DeleteMapping("/{id}")
|
||||
public void deleteFirearm(@PathVariable Long id) {
|
||||
firearmService.deleteFirearm(id);
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.controller;
|
||||
|
||||
import com.onixbyte.ahsarahguide.domain.dto.ErrorResponse;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
/**
|
||||
* Global exception handler that translates exceptions into standard error responses.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(ResponseStatusException.class)
|
||||
public ResponseEntity<ErrorResponse> handleResponseStatusException(ResponseStatusException exception) {
|
||||
var status = exception.getStatusCode();
|
||||
return ResponseEntity.status(status)
|
||||
.body(new ErrorResponse(exception.getReason()));
|
||||
}
|
||||
|
||||
@ExceptionHandler(AuthenticationException.class)
|
||||
public ResponseEntity<ErrorResponse> handleAuthenticationException(AuthenticationException exception) {
|
||||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED)
|
||||
.body(new ErrorResponse("请先登录"));
|
||||
}
|
||||
|
||||
@ExceptionHandler(AccessDeniedException.class)
|
||||
public ResponseEntity<ErrorResponse> handleAccessDeniedException(AccessDeniedException exception) {
|
||||
var authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
var httpStatus = authentication == null || !authentication.isAuthenticated()
|
||||
? HttpStatus.UNAUTHORIZED
|
||||
: HttpStatus.FORBIDDEN;
|
||||
var message = httpStatus == HttpStatus.UNAUTHORIZED ? "请先登录" : "权限不足";
|
||||
return ResponseEntity.status(httpStatus)
|
||||
.body(new ErrorResponse(message));
|
||||
}
|
||||
}
|
||||
|
||||
-109
@@ -1,109 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.controller;
|
||||
|
||||
import com.onixbyte.ahsarahguide.domain.dto.ModificationBatchCreateRequest;
|
||||
import com.onixbyte.ahsarahguide.domain.dto.ModificationRequest;
|
||||
import com.onixbyte.ahsarahguide.domain.dto.ModificationResponse;
|
||||
import com.onixbyte.ahsarahguide.domain.dto.PageResponse;
|
||||
import com.onixbyte.ahsarahguide.domain.entity.User;
|
||||
import com.onixbyte.ahsarahguide.security.annotation.RequiresAuth;
|
||||
import com.onixbyte.ahsarahguide.security.resolver.CurrentUser;
|
||||
import com.onixbyte.ahsarahguide.service.ModificationService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* REST controller for modification CRUD operations, including batch creation and deletion.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Tag(name = "改装管理", description = "对枪械改装的管理")
|
||||
@RestController
|
||||
@RequestMapping("/modifications")
|
||||
public class ModificationController {
|
||||
|
||||
private final ModificationService modificationService;
|
||||
|
||||
public ModificationController(ModificationService modificationService) {
|
||||
this.modificationService = modificationService;
|
||||
}
|
||||
|
||||
@Operation(description = "分页查询改装信息")
|
||||
@Validated
|
||||
@GetMapping
|
||||
public PageResponse<ModificationResponse> pageQuery(
|
||||
@RequestParam(defaultValue = "0") @Min(0) int page,
|
||||
@RequestParam(defaultValue = "20") @Min(1) @Max(100) int size,
|
||||
@RequestParam(required = false) @Positive Long firearmId,
|
||||
@RequestParam(defaultValue = "id") String sortBy,
|
||||
@RequestParam(defaultValue = "DESC") Sort.Direction direction,
|
||||
@RequestParam(required = false) List<String> tags
|
||||
) {
|
||||
return modificationService.pageQuery(firearmId, tags, PageRequest.of(page, size, Sort.by(direction, sortBy)));
|
||||
}
|
||||
|
||||
@Operation(description = "查询指定改装的信息")
|
||||
@GetMapping("/{id}")
|
||||
public ModificationResponse queryById(@PathVariable Long id) {
|
||||
return modificationService.queryById(id);
|
||||
}
|
||||
|
||||
@RequiresAuth
|
||||
@Operation(description = "创建改装")
|
||||
@PostMapping
|
||||
public ModificationResponse create(
|
||||
@CurrentUser User user,
|
||||
@Valid @RequestBody ModificationRequest request
|
||||
) {
|
||||
return modificationService.create(request, user);
|
||||
}
|
||||
|
||||
@RequiresAuth
|
||||
@Operation(description = "批量创建改装")
|
||||
@PostMapping("/batch")
|
||||
public List<ModificationResponse> batchCreate(
|
||||
@CurrentUser User user,
|
||||
@Valid @RequestBody ModificationBatchCreateRequest request
|
||||
) {
|
||||
return modificationService.batchCreate(request.modifications(), user);
|
||||
}
|
||||
|
||||
@RequiresAuth
|
||||
@Operation(description = "修改指定改装")
|
||||
@PutMapping("/{id}")
|
||||
public ModificationResponse update(@PathVariable Long id, @Valid @RequestBody ModificationRequest request) {
|
||||
return modificationService.update(id, request);
|
||||
}
|
||||
|
||||
@RequiresAuth
|
||||
@Operation(description = "删除指定改装")
|
||||
@DeleteMapping("/{id}")
|
||||
public void delete(@PathVariable Long id) {
|
||||
modificationService.delete(id);
|
||||
}
|
||||
|
||||
@RequiresAuth
|
||||
@Operation(description = "批量删除改装")
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Validated
|
||||
public void batchDelete(@RequestParam List<@Positive Long> ids) {
|
||||
modificationService.batchDelete(ids);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.onixbyte.ahsarahguide.service.ModificationService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* REST controller for retrieving available modification tags.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Tag(name = "标签管理", description = "管理标签信息")
|
||||
@RestController
|
||||
@RequestMapping("/tags")
|
||||
public class TagController {
|
||||
|
||||
private final ModificationService modificationService;
|
||||
|
||||
public TagController(ModificationService modificationService) {
|
||||
this.modificationService = modificationService;
|
||||
}
|
||||
|
||||
@Operation(description = "查询指定武器或所有武器的标签")
|
||||
@GetMapping
|
||||
public List<String> getTags(@RequestParam(required = false) Long firearmId) {
|
||||
return modificationService.findAllTags(firearmId);
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.controller;
|
||||
|
||||
import com.onixbyte.ahsarahguide.domain.dto.BuildSummaryResponse;
|
||||
import com.onixbyte.ahsarahguide.domain.dto.ChangePasswordRequest;
|
||||
import com.onixbyte.ahsarahguide.domain.dto.PageResponse;
|
||||
import com.onixbyte.ahsarahguide.domain.dto.UpdateProfileRequest;
|
||||
import com.onixbyte.ahsarahguide.domain.dto.UserProfileResponse;
|
||||
import com.onixbyte.ahsarahguide.domain.entity.User;
|
||||
import com.onixbyte.ahsarahguide.security.annotation.RequiresAuth;
|
||||
import com.onixbyte.ahsarahguide.security.resolver.CurrentUser;
|
||||
import com.onixbyte.ahsarahguide.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* REST controller for the current user's profile management endpoints.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Tag(name = "用户个人中心", description = "当前用户的资料管理与密码修改")
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
@Validated
|
||||
@RequiresAuth
|
||||
public class UserController {
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
public UserController(UserService userService) {
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
@Operation(description = "获取当前登录用户的个人资料")
|
||||
@GetMapping("/me")
|
||||
public UserProfileResponse profile(@CurrentUser User user) {
|
||||
return userService.getProfile(user);
|
||||
}
|
||||
|
||||
@Operation(description = "修改当前用户的个人资料(昵称与邮箱)")
|
||||
@PutMapping("/me")
|
||||
public UserProfileResponse updateProfile(
|
||||
@CurrentUser User user,
|
||||
@Valid @RequestBody UpdateProfileRequest request
|
||||
) {
|
||||
return userService.updateProfile(user, request);
|
||||
}
|
||||
|
||||
@Operation(description = "修改当前用户的登录密码")
|
||||
@PutMapping("/me/password")
|
||||
public ResponseEntity<Void> changePassword(
|
||||
@CurrentUser User user,
|
||||
@Valid @RequestBody ChangePasswordRequest request
|
||||
) {
|
||||
userService.changePassword(user, request);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Operation(description = "分页查询当前用户的改枪码列表")
|
||||
@GetMapping("/me/builds")
|
||||
public PageResponse<BuildSummaryResponse> builds(
|
||||
@CurrentUser User user,
|
||||
@RequestParam(defaultValue = "0") @Min(0) int page,
|
||||
@RequestParam(defaultValue = "20") @Min(1) @Max(100) int size
|
||||
) {
|
||||
return userService.getBuilds(user, PageRequest.of(page, size));
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.controller;
|
||||
|
||||
import com.onixbyte.ahsarahguide.service.AppService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Tag(name = "版本信息")
|
||||
@RestController
|
||||
@RequestMapping("/versions")
|
||||
public class VersionController {
|
||||
|
||||
private final AppService appService;
|
||||
|
||||
public VersionController(AppService appService) {
|
||||
this.appService = appService;
|
||||
}
|
||||
|
||||
@Operation(description = "获取当前应用版本号")
|
||||
@GetMapping
|
||||
public String getVersion() {
|
||||
return appService.getVersion();
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.controller;
|
||||
|
||||
import com.onixbyte.ahsarahguide.domain.dto.GitHubIssueRequest;
|
||||
import com.onixbyte.ahsarahguide.service.WebhookService;
|
||||
import com.onixbyte.ahsarahguide.shared.GitHubWebhookHeader;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Tag(name = "WebHook")
|
||||
@RestController
|
||||
@RequestMapping("/webhooks")
|
||||
public class WebhookController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(WebhookController.class);
|
||||
|
||||
private final WebhookService webhookService;
|
||||
|
||||
public WebhookController(WebhookService webhookService) {
|
||||
this.webhookService = webhookService;
|
||||
}
|
||||
|
||||
@Operation(description = "GitHub WebHook 接口")
|
||||
@PostMapping("/github")
|
||||
public ResponseEntity<Void> handleWebhook(
|
||||
@RequestHeader(GitHubWebhookHeader.EVENT) String event,
|
||||
@RequestBody GitHubIssueRequest request
|
||||
) {
|
||||
if (!"issues".equals(event)) {
|
||||
log.debug("Ignoring non-issue event: {}", event);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
if (!"opened".equals(request.action())) {
|
||||
log.debug("Ignoring issue action: {}", request.action());
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
webhookService.processIssueEvent(request);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.converter;
|
||||
|
||||
import com.onixbyte.ahsarahguide.enumeration.FirearmType;
|
||||
import jakarta.persistence.AttributeConverter;
|
||||
import jakarta.persistence.Converter;
|
||||
|
||||
/**
|
||||
* JPA attribute converter that maps {@link FirearmType} enum to/from its integer database representation.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Converter
|
||||
public class FirearmTypeConverter implements AttributeConverter<FirearmType, Integer> {
|
||||
|
||||
@Override
|
||||
public Integer convertToDatabaseColumn(FirearmType attribute) {
|
||||
return attribute == null ? null : attribute.getCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FirearmType convertToEntityAttribute(Integer dbData) {
|
||||
return FirearmType.fromCode(dbData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.converter;
|
||||
|
||||
import com.onixbyte.ahsarahguide.enumeration.ModificationStatus;
|
||||
import jakarta.persistence.AttributeConverter;
|
||||
import jakarta.persistence.Converter;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* JPA attribute converter that maps {@link ModificationStatus} enum to/from its integer database representation.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Converter
|
||||
public class ModificationStatusConverter implements AttributeConverter<ModificationStatus, Integer> {
|
||||
|
||||
@Override
|
||||
public Integer convertToDatabaseColumn(ModificationStatus attribute) {
|
||||
return Optional.ofNullable(attribute)
|
||||
.map(ModificationStatus::getCode)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModificationStatus convertToEntityAttribute(Integer dbData) {
|
||||
return ModificationStatus.fromCode(dbData);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Request DTO for creating or updating an accessory attached to a modification.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record AccessoryRequest(
|
||||
@NotBlank(message = "插槽名称不能为空")
|
||||
String slotName,
|
||||
@NotBlank(message = "配件名称不能为空")
|
||||
String accessoryName,
|
||||
List<@Valid TuningRequest> tunings
|
||||
) {
|
||||
public List<TuningRequest> tunings() {
|
||||
return tunings == null ? new ArrayList<>() : tunings;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import com.onixbyte.ahsarahguide.domain.entity.Accessory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Response DTO for an accessory attached to a modification.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record AccessoryResponse(
|
||||
String slotName,
|
||||
String accessoryName,
|
||||
List<TuningResponse> tunings
|
||||
) {
|
||||
public static AccessoryResponse from(Accessory accessory) {
|
||||
return new AccessoryResponse(
|
||||
accessory.getSlotName(),
|
||||
accessory.getAccessoryName(),
|
||||
accessory.getTunings() == null
|
||||
? List.of()
|
||||
: accessory.getTunings().stream().map(TuningResponse::from).toList()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Response record summarising a user's custom modification build.
|
||||
* This is a skeleton record whose {@code from()} factory will be fully implemented
|
||||
* when the CustomModification entity is introduced in a future issue.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record BuildSummaryResponse(
|
||||
Long id,
|
||||
String name,
|
||||
String code,
|
||||
String firearmName,
|
||||
List<String> tags
|
||||
) {
|
||||
// from() factory to be implemented when CustomModification entity lands
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* Request record for changing the current user's password.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record ChangePasswordRequest(
|
||||
@NotBlank(message = "旧密码不能为空")
|
||||
String oldPassword,
|
||||
|
||||
@NotBlank(message = "新密码不能为空")
|
||||
@Size(min = 8, max = 128, message = "密码长度必须在8-128个字符之间")
|
||||
@Pattern(
|
||||
regexp = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).+$",
|
||||
message = "密码必须包含至少一个大写字母、一个小写字母和一个数字"
|
||||
)
|
||||
String newPassword
|
||||
) {}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
/**
|
||||
* DTO representing a single daily-generated password for a map.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record DailyPassword(
|
||||
String mapName,
|
||||
String password
|
||||
) {
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* DTO containing daily password data including update information and password list.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record DailyPasswordData(
|
||||
String updateDate,
|
||||
Integer totalCount,
|
||||
List<DailyPassword> passwords,
|
||||
String source,
|
||||
LocalDateTime lastUpdated,
|
||||
Long timestamp
|
||||
) {
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
/**
|
||||
* DTO holding metadata about the daily password source and update tracking.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record DailyPasswordMetadata(
|
||||
String version,
|
||||
String author
|
||||
) {
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
/**
|
||||
* Response DTO wrapping daily password data with metadata.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record DailyPasswordResponse(
|
||||
String status,
|
||||
String message,
|
||||
DailyPasswordData data,
|
||||
DailyPasswordMetadata metadata
|
||||
) {
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
public record EmailVerificationCode(
|
||||
String username,
|
||||
String email,
|
||||
String code
|
||||
) {
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
/**
|
||||
* Standard error response body returned on API failures.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record ErrorResponse(
|
||||
String message
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import com.onixbyte.ahsarahguide.enumeration.FirearmType;
|
||||
|
||||
/**
|
||||
* Request DTO for creating or updating a firearm.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record FirearmRequest(
|
||||
String name,
|
||||
FirearmType type,
|
||||
String level,
|
||||
String calibre,
|
||||
Integer fireRate,
|
||||
Integer armourDamage,
|
||||
Integer bodyDamage,
|
||||
String review
|
||||
) {
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import com.onixbyte.ahsarahguide.domain.entity.Firearm;
|
||||
import com.onixbyte.ahsarahguide.enumeration.FirearmType;
|
||||
|
||||
/**
|
||||
* Response DTO for a firearm record, including associated modifications.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record FirearmResponse(
|
||||
Long id,
|
||||
String name,
|
||||
FirearmType type,
|
||||
String level,
|
||||
String calibre,
|
||||
Integer fireRate,
|
||||
Integer armourDamage,
|
||||
Integer bodyDamage,
|
||||
String review
|
||||
) {
|
||||
public static FirearmResponse from(Firearm firearm) {
|
||||
return new FirearmResponse(
|
||||
firearm.getId(),
|
||||
firearm.getName(),
|
||||
firearm.getType(),
|
||||
firearm.getLevel(),
|
||||
firearm.getCalibre(),
|
||||
firearm.getFireRate(),
|
||||
firearm.getArmourDamage(),
|
||||
firearm.getBodyDamage(),
|
||||
firearm.getReview()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
|
||||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record GitHubIssueRequest(
|
||||
String action,
|
||||
GitHubWebhookIssue issue,
|
||||
GitHubWebhookRepository repository,
|
||||
GitHubWebhookSender sender
|
||||
) {
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record GitHubWebhookIssue(
|
||||
String url,
|
||||
Long id,
|
||||
Long number,
|
||||
String title,
|
||||
String body,
|
||||
List<GitHubWebhookLabel> labels
|
||||
) {
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
|
||||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record GitHubWebhookLabel(
|
||||
String name
|
||||
) {
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
|
||||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record GitHubWebhookRepository(
|
||||
String fullName
|
||||
) {
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
|
||||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record GitHubWebhookSender(
|
||||
String login
|
||||
) {
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* Login request containing principle (username/email) and credential (password).
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Schema(description = "登录请求")
|
||||
public record LoginRequest(
|
||||
@NotBlank(message = "登录名称不能为空")
|
||||
@Schema(description = "用户名或电子邮箱", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
String principle,
|
||||
@NotBlank(message = "登录口令不能为空")
|
||||
@Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
String credential
|
||||
) {
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* Request record for managing a user's role assignment.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record ManageRoleRequest(
|
||||
@NotBlank(message = "角色不能为空")
|
||||
String role
|
||||
) {}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Request DTO for batch creation of modifications.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record ModificationBatchCreateRequest(
|
||||
@NotEmpty(message = "批量创建列表不能为空")
|
||||
List<@Valid ModificationRequest> modifications
|
||||
) {
|
||||
}
|
||||
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Request DTO for batch deletion of modifications by ID.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record ModificationBatchDeleteRequest(
|
||||
@NotEmpty(message = "批量删除ID列表不能为空")
|
||||
List<@Positive(message = "ID必须为正数") Long> ids
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Request DTO for creating or updating a modification.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record ModificationRequest(
|
||||
@NotNull(message = "武器ID不能为空")
|
||||
@Positive(message = "武器ID必须为正数")
|
||||
Long firearmId,
|
||||
@NotBlank(message = "改装名称不能为空")
|
||||
String name,
|
||||
@NotBlank(message = "改装代码不能为空")
|
||||
String code,
|
||||
List<@NotBlank(message = "标签不能为空") String> tags,
|
||||
List<@Valid AccessoryRequest> accessories,
|
||||
String note,
|
||||
String author,
|
||||
String videoUrl
|
||||
) {
|
||||
public List<String> tags() {
|
||||
return tags == null ? new ArrayList<>() : tags;
|
||||
}
|
||||
|
||||
public List<AccessoryRequest> accessories() {
|
||||
return accessories == null ? new ArrayList<>() : accessories;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import com.onixbyte.ahsarahguide.domain.entity.Modification;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Response DTO for a modification record including accessories and tags.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record ModificationResponse(
|
||||
Long id,
|
||||
Long firearmId,
|
||||
String name,
|
||||
String code,
|
||||
List<String> tags,
|
||||
List<AccessoryResponse> accessories,
|
||||
String note,
|
||||
String author,
|
||||
String videoUrl
|
||||
) {
|
||||
public static ModificationResponse from(Modification modification) {
|
||||
return new ModificationResponse(
|
||||
modification.getId(),
|
||||
modification.getFirearm().getId(),
|
||||
modification.getName(),
|
||||
modification.getCode(),
|
||||
modification.getTags(),
|
||||
modification.getAccessories() == null
|
||||
? List.of()
|
||||
: modification.getAccessories().stream().map(AccessoryResponse::from).toList(),
|
||||
modification.getNote(),
|
||||
modification.getAuthor(),
|
||||
modification.getVideoUrl()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Generic paginated response wrapper for list endpoints.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record PageResponse<T>(
|
||||
List<T> items,
|
||||
int page,
|
||||
int size,
|
||||
long totalElements,
|
||||
int totalPages
|
||||
) {
|
||||
public static <T> PageResponse<T> from(Page<T> source) {
|
||||
return new PageResponse<>(
|
||||
source.getContent(),
|
||||
source.getNumber(),
|
||||
source.getSize(),
|
||||
source.getTotalElements(),
|
||||
source.getTotalPages()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* Registration request containing the new user account information.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
@Schema(description = "注册请求")
|
||||
public record RegisterRequest(
|
||||
@NotBlank(message = "用户名不能为空")
|
||||
@Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
String username,
|
||||
@NotBlank(message = "邮箱不能为空")
|
||||
@Email(message = "邮箱格式不正确")
|
||||
@Schema(description = "邮箱", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
String email,
|
||||
@Schema(description = "昵称")
|
||||
String nickname,
|
||||
@Schema(description = "头像链接")
|
||||
String avatarUrl,
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
String password,
|
||||
@NotBlank(message = "验证码 ID 不能为空") String verificationCodeId,
|
||||
@NotBlank(message = "验证码不能为空") String verificationCode
|
||||
) {
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
public record SendVerificationCodeRequest(
|
||||
@NotBlank(message = "用户名不能为空") String username,
|
||||
@NotBlank(message = "电子邮箱地址不能为空") String email
|
||||
) {
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
public record SendVerificationCodeResponse(
|
||||
String verificationCodeId
|
||||
) {
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* Request DTO for a tuning adjustment on an accessory.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record TuningRequest(
|
||||
@NotBlank(message = "调校项名称不能为空")
|
||||
String tuningName,
|
||||
@NotNull(message = "调校值不能为空")
|
||||
Double tuningValue
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import com.onixbyte.ahsarahguide.domain.entity.Tuning;
|
||||
|
||||
/**
|
||||
* Response DTO for a tuning adjustment on an accessory.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record TuningResponse(
|
||||
String tuningName,
|
||||
Double tuningValue
|
||||
) {
|
||||
public static TuningResponse from(Tuning tuning) {
|
||||
return new TuningResponse(
|
||||
tuning.getTuningName(),
|
||||
tuning.getTuningValue()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* Request record for updating the current user's profile information.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record UpdateProfileRequest(
|
||||
@Size(min = 1, max = 64, message = "昵称长度必须在1-64个字符之间")
|
||||
String nickname
|
||||
) {}
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import com.onixbyte.ahsarahguide.domain.entity.User;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Response record for the current user's full profile information.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record UserProfileResponse(
|
||||
Long id,
|
||||
String username,
|
||||
String nickname,
|
||||
String email,
|
||||
String avatarUrl,
|
||||
Boolean enabled,
|
||||
LocalDateTime createdAt,
|
||||
List<String> roles
|
||||
) {
|
||||
|
||||
/**
|
||||
* Creates a {@code UserProfileResponse} from a {@link User} entity and its assigned roles.
|
||||
*
|
||||
* @param user the user entity
|
||||
* @param roles the list of role names assigned to the user
|
||||
* @return the constructed response
|
||||
*/
|
||||
public static UserProfileResponse from(User user, List<String> roles) {
|
||||
return new UserProfileResponse(
|
||||
user.getId(),
|
||||
user.getUsername(),
|
||||
user.getNickname() == null || user.getNickname().isBlank()
|
||||
? user.getUsername() : user.getNickname(),
|
||||
user.getEmail(),
|
||||
user.getAvatarUrl(),
|
||||
user.getEnabled(),
|
||||
user.getCreatedAt(),
|
||||
roles
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.dto;
|
||||
|
||||
import com.onixbyte.ahsarahguide.domain.entity.User;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* Response DTO for a user account, including associated credentials.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record UserResponse(
|
||||
Long id,
|
||||
String username,
|
||||
String email,
|
||||
LocalDateTime expiration
|
||||
) {
|
||||
public static UserResponse from(User user, LocalDateTime expiration) {
|
||||
return new UserResponse(
|
||||
user.getId(),
|
||||
user.getUsername(),
|
||||
user.getEmail(),
|
||||
expiration
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.onixbyte.ahsarahguide.domain.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Entity representing an accessory attached to a modification, stored as JSONB.
|
||||
*
|
||||
* @author zihluwang
|
||||
*/
|
||||
public class Accessory {
|
||||
|
||||
private String slotName;
|
||||
|
||||
private String accessoryName;
|
||||
|
||||
private List<Tuning> tunings = new ArrayList<>();
|
||||
|
||||
public Accessory() {
|
||||
}
|
||||
|
||||
public String getSlotName() {
|
||||
return slotName;
|
||||
}
|
||||
|
||||
public void setSlotName(String slotName) {
|
||||
this.slotName = slotName;
|
||||
}
|
||||
|
||||
public String getAccessoryName() {
|
||||
return accessoryName;
|
||||
}
|
||||
|
||||
public void setAccessoryName(String accessoryName) {
|
||||
this.accessoryName = accessoryName;
|
||||
}
|
||||
|
||||
public List<Tuning> getTunings() {
|
||||
return tunings;
|
||||
}
|
||||
|
||||
public void setTunings(List<Tuning> tunings) {
|
||||
this.tunings = tunings;
|
||||
}
|
||||
|
||||
public void addTuning(Tuning tuning) {
|
||||
this.tunings.add(tuning);
|
||||
}
|
||||
|
||||
public void removeTuning(Tuning tuning) {
|
||||
this.tunings.remove(tuning);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof Accessory accessory)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(slotName, accessory.slotName)
|
||||
&& Objects.equals(accessoryName, accessory.accessoryName)
|
||||
&& Objects.equals(tunings, accessory.tunings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(slotName, accessoryName, tunings);
|
||||
}
|
||||
}
|
||||
Loaded 100 of 320 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user