Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
holmofy committed Sep 18, 2024
1 parent 247548f commit 5fa72aa
Show file tree
Hide file tree
Showing 12 changed files with 2,305 additions and 44 deletions.
4 changes: 4 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ publish-api:
## admin dev
admin-dev:
pnpm --dir=packages/admin dev

## client dev
client-dev:
pnpm --dir=packages/client dev
4 changes: 2 additions & 2 deletions packages/api/src/articleCounter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const getArticleCounter = ({
signal,
}: GetArticleCounterOptions): Promise<GetArticleCounterResponse> =>
fetch(
`${getFetchPrefix(serverURL)}article?path=${encodeURIComponent(
`${getFetchPrefix(serverURL)}view?path=${encodeURIComponent(
paths.join(','),
)}&type=${encodeURIComponent(type.join(','))}&lang=${lang}`,
{ signal },
Expand Down Expand Up @@ -95,7 +95,7 @@ export const updateArticleCounter = ({
type,
action,
}: UpdateArticleCounterOptions): Promise<GetArticleCounterResponse> =>
fetch(`${getFetchPrefix(serverURL)}article?lang=${lang}`, {
fetch(`${getFetchPrefix(serverURL)}view?lang=${lang}`, {
method: 'POST',
headers: JSON_HEADERS,
body: JSON.stringify({ path, type, action }),
Expand Down
Binary file added packages/client/.DS_Store
Binary file not shown.
7 changes: 4 additions & 3 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
],
"scripts": {
"build": "pnpm rollup && pnpm style",
"clean": "rimraf ./dist",
"clean": "rm -rf ./dist",
"dev": "vite",
"prepublishOnly": "pnpm clean && pnpm build",
"rollup": "rollup -c rollup.config.ts --configPlugin esbuild",
Expand All @@ -83,9 +83,9 @@
},
"dependencies": {
"@raline/api": "0.0.1",
"@vueuse/core": "^11.0.3",
"@vueuse/core": "^11.1.0",
"autosize": "^6.0.1",
"marked": "^14.1.1",
"marked": "^14.1.2",
"marked-highlight": "^2.1.4",
"recaptcha-v3": "^1.11.3",
"vue": "^3.5.3"
Expand All @@ -101,6 +101,7 @@
"@vitejs/plugin-vue": "5.1.3",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-esbuild": "^6.1.1",
"sass-embedded": "^1.79.1",
"user-agent-data-types": "0.4.2",
"vite": "5.4.3"
},
Expand Down
2,288 changes: 2,254 additions & 34 deletions packages/client/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/client/src/init.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createApp, h, reactive, watchEffect } from 'vue';

import { commentCount } from './comment.js';
import raline from './components/ralineComment.vue';
import raline from './components/RalineComment.vue';
import { pageviewCount } from './pageview.js';
import type { ralineInitOptions } from './typings/index.js';
import { getRoot, isString } from './utils/index.js';
Expand Down
File renamed without changes.
25 changes: 25 additions & 0 deletions src/dto/comment.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use serde::Deserialize;
use validator::Validate;

use crate::model::sea_orm_active_enums::CommentStatus;

#[derive(Debug, Validate, Deserialize)]
pub struct CommentQueryReq {
pub r#type: ShowType,
pub status: CommentStatus,
pub owner: Owner,
#[validate(length(max = 32, message = "查询关键字过长"))]
pub keyword: Option<String>,
}

#[derive(Debug, Deserialize)]
pub enum ShowType {
List,
Tree,
}

#[derive(Debug, Deserialize)]
pub enum Owner {
All,
Mine,
}
3 changes: 2 additions & 1 deletion src/dto/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub mod user;
pub mod view_counter;
pub mod view_counter;
pub mod comment;
14 changes: 12 additions & 2 deletions src/http/comment.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
use crate::dto::comment::CommentQueryReq;
use sea_orm::TransactionTrait;
use spring_sea_orm::DbConn;
use spring_web::{axum::response::IntoResponse, error::Result, extractor::Component, get};
use spring_web::{
axum::response::IntoResponse,
error::Result,
extractor::{Component, Query},
get,
};

#[get("/comment")]
async fn get_comment(Component(db): Component<DbConn>) -> Result<impl IntoResponse> {
async fn get_comment(
Component(db): Component<DbConn>,
Query(req): Query<CommentQueryReq>,
) -> Result<impl IntoResponse> {
Ok("")
}
2 changes: 1 addition & 1 deletion src/http/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use spring_web::{
extractor::Component,
put,
};
use spring_web::{extractor::Config, patch, post};
use spring_web::{extractor::Config, post};

#[post("/user")]
async fn register(
Expand Down

0 comments on commit 5fa72aa

Please sign in to comment.