Skip to content

Commit

Permalink
Initialize backend implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
gudaoxuri committed Dec 8, 2023
1 parent 91fe8cc commit 894f2bf
Show file tree
Hide file tree
Showing 17 changed files with 218 additions and 8 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ jobs:
pnpm install
- name: Test
run: pnpm run test
run: |
cd ./frontend
pnpm run test
- name: Build
run: pnpm run build
run: |
cd ./frontend
pnpm run build
- name: Publish to NPM
uses: JS-DevTools/npm-publish@v2
Expand Down Expand Up @@ -100,10 +104,13 @@ jobs:
pnpm install
- name: Test
run: pnpm run test
run: |
cd ./frontend
pnpm run test
- name: Build with VitePress
run: |
cd ./frontend
pnpm run docs:build
touch docs/.vitepress/dist/.nojekyll
Expand All @@ -113,7 +120,7 @@ jobs:
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: docs/.vitepress/dist
path: ./frontend/docs/.vitepress/dist

doc-deploy:
name: DocDeploy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/leak_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
with:
keywords: ${{secrets.LEAK_WORDS}}
ignoreCase: true
ignoredDirs: '["docs","node_modules","pnpm-lock.yaml"]'
ignoredDirs: '["frontend/docs","frontend/node_modules","frontend/pnpm-lock.yaml"]'
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
frontend/.gitignore
node_modules
dist
dist-ssr
target
*.local
frontend/docs/.vitepress/cache
frontend/docs/.vitepress/.temp
frontend/docs/api
types
.idea
.DS_Store

7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"vue-i18n.i18nPaths": "src\\assets\\locales"
}
"vue-i18n.i18nPaths": "src\\assets\\locales",
"rust-analyzer.linkedProjects": [
".\\backend\\kernel\\Cargo.toml"
]
}
1 change: 1 addition & 0 deletions backend/kernel/src/domain.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod tt_table_props;
30 changes: 30 additions & 0 deletions backend/kernel/src/domain/tt_table_props.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use tardis::chrono::Utc;
use tardis::db::sea_orm;
use tardis::db::sea_orm::prelude::Json;
use tardis::db::sea_orm::*;
use tardis::{chrono, TardisCreateEntity, TardisEmptyBehavior, TardisEmptyRelation};

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, TardisCreateEntity, TardisEmptyBehavior, TardisEmptyRelation)]
#[sea_orm(table_name = "tt_table_props")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub table_id: String,
pub pk_column_name: String,
pub parent_pk_column_name: String,
pub columns: Json,
pub layouts: Json,
pub styles: Json,

#[index]
#[sea_orm(extra = "DEFAULT CURRENT_TIMESTAMP")]
pub create_time: chrono::DateTime<Utc>,

#[index]
#[sea_orm(extra = "DEFAULT CURRENT_TIMESTAMP")]
pub update_time: chrono::DateTime<Utc>,

#[fill_ctx(own_paths)]
pub own_paths: String,
#[fill_ctx(owner)]
pub owner: String,
}
3 changes: 3 additions & 0 deletions backend/kernel/src/dto.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub mod tt_data_dtos;
pub mod tt_layout_dtos;
pub mod tt_table_dtos;
63 changes: 63 additions & 0 deletions backend/kernel/src/dto/tt_data_dtos.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
use serde::{Serialize, Deserialize};
use tardis::serde_json::Value;

#[derive(Serialize, Deserialize, Debug)]
pub struct TableDataFilterReq {
items: Vec<TableDataFilterItemReq>,
and: bool,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct TableDataFilterItemReq {
column_name: String,
operator: String,
value: Option<Value>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct TableDataSortReq {
column_name: String,
order_desc: bool,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct TableDataGroupReq {
column_names: Vec<String>,
group_order_desc: bool,
hide_empty_record: bool,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct TableDataSliceReq {
offset_number: i32,
fetch_number: i32,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct TableDataResp {
records: Vec<Value>,
aggs: Value,
total_number: i32,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct TableDataGroupResp {
records: Vec<Value>,
aggs: Value,
total_number: i32,
group_value: String,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct TableCellDictItem {
title: String,
value: Value,
color: Option<String>,
avatar: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct TableCellDictItemResp {
records: Vec<TableCellDictItem>,
total_number: i32,
}
49 changes: 49 additions & 0 deletions backend/kernel/src/dto/tt_layout_dtos.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
use std::collections::HashMap;

use serde::{Deserialize, Serialize};
use tardis::serde_json::Value;

use super::tt_data_dtos::{TableDataFilterReq, TableDataGroupReq, TableDataSortReq};

#[derive(Serialize, Deserialize, Debug)]
pub struct TableLayoutProps {
id: String,
title: String,
layout_kind: String,
icon: Option<String>,
columns: Vec<TableLayoutColumnProps>,
filters: Option<Vec<TableDataFilterReq>>,
sorts: Option<Vec<TableDataSortReq>>,
group: Option<TableDataGroupReq>,
aggs: Option<HashMap<String, String>>,
expand_data_pks: Option<Vec<Value>>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct TableLayoutColumnProps {
name: String,
wrap: Option<bool>,
fixed: Option<bool>,
width: Option<f64>,
hide: Option<bool>,
date_start: Option<bool>,
date_end: Option<bool>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct TableLayoutModifyReq {
id: Option<String>,
title: Option<String>,
icon: Option<String>,
filters: Option<Vec<TableDataFilterReq>>,
sorts: Option<Vec<TableDataSortReq>>,
group: Option<TableDataGroupReq>,
aggs: Option<HashMap<String, String>>,
new_expand_data_pk: Option<Value>,
delete_expand_data_pk: Option<Value>,
fetch_data_number: Option<i32>,
column_sorted_names: Option<(String, String)>,
new_column: Option<TableLayoutColumnProps>,
changed_column: Option<TableLayoutColumnProps>,
deleted_column_name: Option<String>,
}
35 changes: 35 additions & 0 deletions backend/kernel/src/dto/tt_table_dtos.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use serde::{Serialize, Deserialize};

use super::tt_layout_dtos::TableLayoutProps;

#[derive(Serialize, Deserialize, Debug)]
pub struct TableProps {
parent_pk_column_name: Option<String>,
columns: Vec<TableColumnProps>,
layouts: Option<Vec<TableLayoutProps>>,
styles: Option<TableStyleProps>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct TableColumnProps {
name: String,
icon: Option<String>,
title: Option<String>,
data_kind: Option<String>,
data_editable: Option<bool>,
use_dict: Option<bool>,
dict_editable: Option<bool>,
multi_value: Option<bool>,
kind_date_time_format: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct TableStyleProps {
size: Option<String>,
theme: Option<String>,
table_class: Option<String>,
header_class: Option<String>,
row_class: Option<String>,
cell_class: Option<String>,
agg_class: Option<String>,
}
3 changes: 3 additions & 0 deletions backend/kernel/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mod domain;
pub mod dto;
pub mod process;
5 changes: 5 additions & 0 deletions backend/kernel/src/process.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mod tt_basic_process;
pub mod tt_cell_dict_process;
pub mod tt_data_process;
pub mod tt_layout_process;
pub mod tt_table_process;
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit 894f2bf

Please sign in to comment.