diff --git a/backend/app/api/api_v1/routers/platform.py b/backend/app/api/api_v1/routers/platform.py index 0a3e421..2ab6b46 100644 --- a/backend/app/api/api_v1/routers/platform.py +++ b/backend/app/api/api_v1/routers/platform.py @@ -254,7 +254,7 @@ async def userdomain_details( async def create_userdomain( request: Request, userid: int, - domainids:list, + domainids:List[int] , db=Depends(get_db), ): try: diff --git a/backend/app/core/security.py b/backend/app/core/security.py index 8e0f70f..20b1c95 100644 --- a/backend/app/core/security.py +++ b/backend/app/core/security.py @@ -35,6 +35,8 @@ def create_access_token(*, data: dict, expires_delta: timedelta = None): return encoded_jwt def chacha20Encrypt(plaintext:str, key=config.KINTONE_PSW_CRYPTO_KEY): + if plaintext is None or plaintext == '': + return None nonce = os.urandom(16) algorithm = algorithms.ChaCha20(key, nonce) cipher = Cipher(algorithm, mode=None) diff --git a/backend/app/db/crud.py b/backend/app/db/crud.py index 0ee5161..2101ad9 100644 --- a/backend/app/db/crud.py +++ b/backend/app/db/crud.py @@ -216,24 +216,19 @@ def edit_domain( update_data = domain.dict(exclude_unset=True) for key, value in update_data.items(): - if(key != "id"): - setattr(db_domain, key, value) - + if key != "id" and not (key == "kintonepwd" and (value is None or value == "")): + setattr(db_domain, key, value) + print(str(db_domain)) db.add(db_domain) db.commit() db.refresh(db_domain) return db_domain -def add_userdomain(db: Session, userid:int,domainids:list): - for domainid in domainids: - db_domain = models.UserDomain( - userid = userid, - domainid = domainid - ) - db.add(db_domain) +def add_userdomain(db: Session, userid:int,domainids:list[str]): + dbCommits = list(map(lambda domainid: models.UserDomain(userid = userid, domainid = domainid ), domainids)) + db.bulk_save_objects(dbCommits) db.commit() - db.refresh(db_domain) - return db_domain + return dbCommits def delete_userdomain(db: Session, userid: int,domainid: int): db_domain = db.query(models.UserDomain).filter(and_(models.UserDomain.userid == userid,models.UserDomain.domainid == domainid)).first() diff --git a/frontend/package.json b/frontend/package.json index 548b749..cbca6a3 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,14 +12,15 @@ "dev": "quasar dev", "dev:local": "set \"LOCAL=true\" && quasar dev", "build": "set \"SOURCE_MAP=false\" && quasar build", - "build:dev":"set \"SOURCE_MAP=true\" && quasar build" - + "build:dev": "set \"SOURCE_MAP=true\" && quasar build" }, "dependencies": { "@quasar/extras": "^1.16.4", "@vueuse/core": "^10.9.0", "axios": "^1.4.0", + "jwt-decode": "^4.0.0", "pinia": "^2.1.7", + "pinia-plugin-persistedstate": "^3.2.1", "quasar": "^2.6.0", "uuid": "^9.0.0", "vue": "^3.0.0", diff --git a/frontend/src/boot/axios.ts b/frontend/src/boot/axios.ts index b12ede8..8548a4d 100644 --- a/frontend/src/boot/axios.ts +++ b/frontend/src/boot/axios.ts @@ -2,6 +2,7 @@ import { boot } from 'quasar/wrappers'; import axios, { AxiosInstance } from 'axios'; import {router} from 'src/router'; + declare module '@vue/runtime-core' { interface ComponentCustomProperties { $axios: AxiosInstance; @@ -15,30 +16,10 @@ declare module '@vue/runtime-core' { // good idea to move this instance creation inside of the // "export default () => {}" function below (which runs individually // for each client) + const api:AxiosInstance = axios.create({ baseURL: process.env.KAB_BACKEND_URL }); -const token=localStorage.getItem('token')||''; -if(token!==''){ - api.defaults.headers["Authorization"]='Bearer ' + token; -} -//axios例外キャプチャー -api.interceptors.response.use( - (response)=>response, - (error)=>{ - if (error.response && error.response.status === 401) { - // 認証エラーの場合再ログインする - console.error('(; ゚Д゚)/認証エラー(401):', error); - localStorage.removeItem('token'); - router.replace({ - path:"/login", - query:{redirect:router.currentRoute.value.fullPath} - }); - } - return Promise.reject(error); - } -) export default boot(({ app }) => { // for use inside Vue files (Options API) through this.$axios and this.$api - app.config.globalProperties.$axios = axios; // ^ ^ ^ this will allow you to use this.$axios (for Vue Options API form) // so you won't necessarily have to import axios in each vue file diff --git a/frontend/src/components/AppInfo.vue b/frontend/src/components/AppInfo.vue index 5aacc39..417a651 100644 --- a/frontend/src/components/AppInfo.vue +++ b/frontend/src/components/AppInfo.vue @@ -21,7 +21,7 @@ - +