-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from pylover7/develop-1.0.1
✨ develop-1.01
- Loading branch information
Showing
83 changed files
with
2,011 additions
and
822 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
*.local | ||
.eslintcache | ||
report.html | ||
*/logs | ||
|
||
yarn.lock | ||
npm-debug.log* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,48 @@ | ||
name: Docker Image CI | ||
name: 创建并发布Docker镜像 | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
release: | ||
types: [published] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
# | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: 登录docker仓库 | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
- name: 提取Docker的元数据:tags,labels | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
- name: 构建并发布Docker镜像 | ||
id: push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }}, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: 生成工件证明 | ||
uses: actions/attest-build-provenance@v1 | ||
with: | ||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | ||
subject-digest: ${{ steps.push.outputs.digest }} | ||
push-to-registry: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
*.sqlite* | ||
.venv/ | ||
*/migrations | ||
*/logs | ||
|
||
# frontend | ||
node_modules | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
构建镜像 | ||
|
||
```bash | ||
docker build -t material-manager:0.0.8 . | ||
docker build -t material:1.0.1 . | ||
``` | ||
|
||
启动容器 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# coding=utf-8 | ||
# @FileName :area.py | ||
# @Time :2024/12/3 16:00 | ||
# @Author :dayezi | ||
from fastapi import APIRouter, Query | ||
from tortoise.expressions import Q | ||
from tortoise.exceptions import IntegrityError | ||
|
||
from app.controllers.area import areaController | ||
from app.schemas import Success, SuccessExtra, Fail | ||
from app.schemas.area import AreaCreate, AreaUpdate | ||
from app.utils import generate_uuid | ||
|
||
areaRouter = APIRouter() | ||
|
||
@areaRouter.post("/add", summary="新增区域") | ||
async def create_area( | ||
data: AreaCreate, | ||
): | ||
data.uuid = generate_uuid(data.name).__str__() | ||
try: | ||
area = await areaController.create(obj_in=data) | ||
except IntegrityError: | ||
return Fail(msg="区域名称或编码已存在") | ||
return Success(data=await area.to_dict()) | ||
|
||
|
||
@areaRouter.delete("/delete", summary="删除区域") | ||
async def delete_area( | ||
id: int, | ||
): | ||
await areaController.remove(id) | ||
return Success(msg="删除成功") | ||
|
||
@areaRouter.put("/update", summary="更新区域") | ||
async def update_area( | ||
data: AreaUpdate, | ||
): | ||
area = await areaController.update(id=data.id, obj_in=data) | ||
return Success(data=await area.to_dict()) | ||
|
||
@areaRouter.get("/updateStatus", summary="修改区域状态") | ||
async def update_area_status( | ||
id: int = Query(..., description="区域ID"), | ||
status: int = Query(..., description="状态:启用/停用"), | ||
): | ||
area = await areaController.update(id=id, obj_in={"status": status}) | ||
return Success(data=await area.to_dict()) | ||
|
||
|
||
@areaRouter.get("/list", summary="查看区域列表") | ||
async def list_area( | ||
currentPage: int = Query(1, description="页码"), | ||
pageSize: int = Query(10, description="每页数量"), | ||
name: str = Query("", description="区域名称,用于搜索"), | ||
code: str = Query("", description="区域编码,用于搜索"), | ||
): | ||
q = Q() | ||
if name: | ||
q &= Q(name__icontains=name) | ||
if code: | ||
q &= Q(code__icontains=code) | ||
total, area_list = await areaController.list(currentPage, pageSize, q) | ||
data = [] | ||
for area in area_list: | ||
item = await area.to_dict() | ||
data.append(item) | ||
return SuccessExtra(total=total, data=data, msg="查询成功", currentPage=currentPage, pageSize=pageSize) | ||
|
||
@areaRouter.get("/all", summary="查看所有区域") | ||
async def list_area(): | ||
area_list = await areaController.all() | ||
data = [] | ||
for area in area_list: | ||
if area.status == 0: | ||
continue | ||
item = await area.to_dict() | ||
data.append(item) | ||
return Success(data=data, msg="查询成功") |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.