diff --git a/oab/migrations/20220720220617_base.sql b/oab/migrations/20220720220617_base.sql index 89f1a7d..7f36cf8 100644 --- a/oab/migrations/20220720220617_base.sql +++ b/oab/migrations/20220720220617_base.sql @@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS `app` `created` datetime DEFAULT CURRENT_TIMESTAMP, `updated` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `key` varchar(32) NOT NULL, + `_key` varchar(32) NOT NULL, `name` varchar(255) NOT NULL, `icon` varchar(255), `des` varchar(255), @@ -130,7 +130,7 @@ CREATE TABLE IF NOT EXISTS `access` -INSERT INTO `app` (`id`, `name`, `key`, `role_id`) +INSERT INTO `app` (`id`, `name`, `_key`, `role_id`) VALUES ('FR9P5t8debxc11aFF', 'oa', 'AMpjwQHwVjGsb1WC4WG6', '1lytMwQL4uiNd0vsc'); INSERT INTO `resource` (`app_id`, `name`) diff --git a/oab/src/api/appuser.rs b/oab/src/api/appuser.rs index 07d3c21..46bd778 100644 --- a/oab/src/api/appuser.rs +++ b/oab/src/api/appuser.rs @@ -9,7 +9,10 @@ use actix_web::{get, web, Responder}; use proc::access_read; use sea_orm::{ColumnTrait, EntityTrait, QueryFilter}; -use crate::{models::app_user, AppState, Error, Result}; +use crate::{ + models::{app, app_user}, + AppState, Error, Result, +}; #[get("/app/{aid}/user/{uid}")] #[access_read("app")] @@ -32,7 +35,19 @@ pub async fn get( if uid.is_empty() && aid.is_empty() { Err(Error::Missing("uid or aid".to_string())) } else { - let s: Vec = q.all(stat.db()).await?; - Ok(web::Json(s)) + let s: Vec<(app_user::Model, Option)> = + q.find_also_related(app::Entity).all(stat.db()).await?; + let res: Vec = s + .into_iter() + .filter_map(|(l, a)| match a { + Some(a) => Some(app::Model { + status: l.status, + ..a + }), + None => None, + }) + .collect(); + // let s: Vec = q.all(stat.db()).await?; + Ok(web::Json(res)) } } diff --git a/oab/src/main.rs b/oab/src/main.rs index cfc3cef..c193f9c 100644 --- a/oab/src/main.rs +++ b/oab/src/main.rs @@ -54,14 +54,15 @@ async fn web(data: AppState) -> Result<()> { .into() }); let cors = actix_cors::Cors::default() + .allow_any_header() .allow_any_origin() .allow_any_method(); let app = App::new(); app.wrap(logger) + .wrap(cors) .wrap(middleware::Compress::default()) .app_data(web::Data::new(data.clone())) .service(fs::Files::new("/media", data.media_path.clone()).show_files_listing()) - .wrap(cors) .service( web::scope("api") .wrap( diff --git a/oaweb/package.json b/oaweb/package.json index aeb4d94..92c7259 100644 --- a/oaweb/package.json +++ b/oaweb/package.json @@ -16,7 +16,7 @@ "@quasar/extras": "^1.16.4", "@veypi/msg": "^0.1.0", "@veypi/one-icon": "2", - "@veypi/oaer": "file:~/test/oaer", + "@veypi/oaer": "^0.0.1", "animate.css": "^4.1.1", "axios": "^1.2.1", "js-base64": "^3.7.5", diff --git a/oaweb/quasar.config.js b/oaweb/quasar.config.js index 22f36a6..02ba8c7 100644 --- a/oaweb/quasar.config.js +++ b/oaweb/quasar.config.js @@ -84,7 +84,9 @@ module.exports = configure(function(/* ctx */) { // polyfillModulePreload: true, // distDir - // extendViteConf (viteConf) {}, + extendViteConf(viteConf) { + viteConf.resolve.preserveSymlinks = true; + }, // viteVuePluginOptions: {}, vitePlugins: [ diff --git a/oaweb/src/boot/pack.ts b/oaweb/src/boot/pack.ts index 8d00ac9..ed96d88 100644 --- a/oaweb/src/boot/pack.ts +++ b/oaweb/src/boot/pack.ts @@ -10,13 +10,13 @@ import { boot } from 'quasar/wrappers' import '@veypi/msg/index.css' import '../assets/icon.js' -import s from '@veypi/oaer' +// import { Cfg } from '@veypi/oaer' +import { Cfg } from '@veypi/oaer' +// import { Cfg } from '/Users/veypi/test/oaer' - -// import { Cfg } from 'src/oaer' -// Cfg.host.value = 'http://' + window.location.host -// Cfg.token.value = localStorage.getItem('auth_token') || '' -// Cfg.uuid.value = 'FR9P5t8debxc11aFF' +Cfg.host.value = 'http://' + window.location.host +Cfg.token.value = localStorage.getItem('auth_token') || '' +Cfg.uuid.value = 'FR9P5t8debxc11aFF' // "async" is optional; // more info on params: https://v2.quasar.dev/quasar-cli/boot-files diff --git a/oaweb/yarn.lock b/oaweb/yarn.lock index 1cd743f..a9dfc2f 100644 --- a/oaweb/yarn.lock +++ b/oaweb/yarn.lock @@ -465,6 +465,22 @@ resolved "https://registry.yarnpkg.com/@veypi/msg/-/msg-0.1.0.tgz#2ebe899527a11ed11f68c2c96f468cfcc66ad3d4" integrity sha512-58dj5nnpHsxaiK5sbPiDK5t8OF4uvN+kAmWhU0BRAgXHpkxkZNZ8rn7hXvSVybG1BbM8EuMNkq0lIxGYNKl8aw== +"@veypi/oaer@file:../../../test/oaer": + version "0.0.1" + dependencies: + "@veypi/msg" "^0.1.0" + "@veypi/one-icon" "2" + animate.css "^4.1.1" + autoprefixer "^10.4.16" + axios "^1.5.1" + js-base64 "^3.7.5" + mitt "^3.0.1" + path "^0.12.7" + postcss "^8.4.31" + tailwindcss "^3.3.3" + vue "^3.3.4" + webdav "^5.3.0" + "@veypi/one-icon@2": version "2.0.6" resolved "https://registry.yarnpkg.com/@veypi/one-icon/-/one-icon-2.0.6.tgz#158c692971848524cd59db1a61d88805d2e45646" @@ -744,6 +760,18 @@ autoprefixer@^10.4.15: picocolors "^1.0.0" postcss-value-parser "^4.2.0" +autoprefixer@^10.4.16: + version "10.4.16" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.16.tgz#fad1411024d8670880bdece3970aa72e3572feb8" + integrity sha512-7vd3UC6xKp0HLfua5IjZlcXvGAGy7cBAXTg2lyQ/8WpNhd6SiZ8Be+xm3FyBSYJx5GKcpRCzBh7RH4/0dnY+uQ== + dependencies: + browserslist "^4.21.10" + caniuse-lite "^1.0.30001538" + fraction.js "^4.3.6" + normalize-range "^0.1.2" + picocolors "^1.0.0" + postcss-value-parser "^4.2.0" + axios@^1.2.1: version "1.5.0" resolved "https://registry.yarnpkg.com/axios/-/axios-1.5.0.tgz#f02e4af823e2e46a9768cfc74691fdd0517ea267" @@ -753,6 +781,15 @@ axios@^1.2.1: form-data "^4.0.0" proxy-from-env "^1.1.0" +axios@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.5.1.tgz#11fbaa11fc35f431193a9564109c88c1f27b585f" + integrity sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A== + dependencies: + follow-redirects "^1.15.0" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" @@ -896,6 +933,11 @@ caniuse-lite@^1.0.30001517, caniuse-lite@^1.0.30001520: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001534.tgz#f24a9b2a6d39630bac5c132b5dff89b39a12e7dd" integrity sha512-vlPVrhsCS7XaSh2VvWluIQEzVhefrUQcEsQWSS5A5V+dM07uv1qHeQzAOTGIMy9i3e9bH15+muvI/UHojVgS/Q== +caniuse-lite@^1.0.30001538: + version "1.0.30001546" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001546.tgz#10fdad03436cfe3cc632d3af7a99a0fb497407f0" + integrity sha512-zvtSJwuQFpewSyRrI3AsftF6rM0X80mZkChIt1spBGEvRglCrjTniXvinc8JKRoqTwXAgvqTImaN9igfSMtUBw== + chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" @@ -1836,7 +1878,7 @@ forwarded@0.2.0: resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== -fraction.js@^4.2.0: +fraction.js@^4.2.0, fraction.js@^4.3.6: version "4.3.6" resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.3.6.tgz#e9e3acec6c9a28cf7bc36cbe35eea4ceb2c5c92d" integrity sha512-n2aZ9tNfYDwaHhvFTkhFErqOMIb8uyzSQ+vGJBjZyanAKZVbGUQ1sngfk9FdkBw7G26O7AgNjLcecLffD1c7eg== @@ -2056,6 +2098,11 @@ inherits@2, inherits@2.0.4, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== +inherits@2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw== + inquirer@^8.2.1: version "8.2.6" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-8.2.6.tgz#733b74888195d8d400a67ac332011b5fae5ea562" @@ -2697,6 +2744,14 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== +path@^0.12.7: + version "0.12.7" + resolved "https://registry.yarnpkg.com/path/-/path-0.12.7.tgz#d4dc2a506c4ce2197eb481ebfcd5b36c0140b10f" + integrity sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q== + dependencies: + process "^0.11.1" + util "^0.10.3" + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" @@ -2778,6 +2833,15 @@ postcss@^8.1.10, postcss@^8.4.13, postcss@^8.4.23, postcss@^8.4.29: picocolors "^1.0.0" source-map-js "^1.0.2" +postcss@^8.4.31: + version "8.4.31" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d" + integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ== + dependencies: + nanoid "^3.3.6" + picocolors "^1.0.0" + source-map-js "^1.0.2" + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -2793,6 +2857,11 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== +process@^0.11.1: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== + proxy-addr@~2.0.7: version "2.0.7" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" @@ -3408,6 +3477,13 @@ util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1: resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== +util@^0.10.3: + version "0.10.4" + resolved "https://registry.yarnpkg.com/util/-/util-0.10.4.tgz#3aa0125bfe668a4672de58857d3ace27ecb76901" + integrity sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A== + dependencies: + inherits "2.0.3" + utils-merge@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" @@ -3464,7 +3540,7 @@ vue-router@^4.0.0: dependencies: "@vue/devtools-api" "^6.5.0" -vue@^3.0.0, vue@^3.2.20: +vue@^3.0.0, vue@^3.2.20, vue@^3.3.4: version "3.3.4" resolved "https://registry.yarnpkg.com/vue/-/vue-3.3.4.tgz#8ed945d3873667df1d0fcf3b2463ada028f88bd6" integrity sha512-VTyEYn3yvIeY1Py0WaYGZsXnz3y5UnGi62GjVEqvEGPl6nxbOrCXbVOTQWBEJUqAyTUk2uJ5JLVnYJ6ZzGbrSw==