GithubHelp home page GithubHelp logo

Comments (12)

diabloevagto avatar diabloevagto commented on July 19, 2024 2

是不是該考慮趁這個機會把所有 api 都重新定義過?目前 api 定義完全沒考慮前端跟 wf
目前的 api 其實開得非常糟糕,說真的前端專案我認為已經失控了

from camera-trap-api.

 avatar commented on July 19, 2024

@trashmai 我們現在還是用 project title 來當 uniqueID 嗎?

from camera-trap-api.

kelp404 avatar kelp404 commented on July 19, 2024

I will fix it today.

from camera-trap-api.

oahehc avatar oahehc commented on July 19, 2024

補充 & 提醒一下,
目前已經有個 projectId (計畫編號) 是讓 user 自行 key in 且可以編輯的,
所以這邊應該是會另外產生 unique key for project 對嗎?

image

from camera-trap-api.

kelp404 avatar kelp404 commented on July 19, 2024

@oahehc 改過去了 b37e14f

from camera-trap-api.

oahehc avatar oahehc commented on July 19, 2024

@kelp404

  1. 如上面 comment 所提, projectId 目前是被使用在計畫編號, 是 user 手動 key in 且可以編輯的欄位, 直接拿來作為 project key 是否適合建議再評估一下
  2. 權限中請協助加上 project unique key, 目前只給 title & roles 可能會 mapping 不到正確的權限
endpoint GET /ctp-user/me

image

from camera-trap-api.

kelp404 avatar kelp404 commented on July 19, 2024

We need to check all logic about Project.
like this:
https://github.com/TaiBIF/camera-trap-api/blob/master/common/models/project.js#L49

from camera-trap-api.

 avatar commented on July 19, 2024

Hi both,
We should indeed review this. I'd suggest:

  1. change the current "projectId" to "adminProjectId" since it's user input and not mandatory
  2. add an automatically generated projectId field for mongoDB identity use and for /ctp-user/me alike
  3. update documentation.

makes sense?

from camera-trap-api.

kelp404 avatar kelp404 commented on July 19, 2024

2018-11-25 3 29 40

請問 projectId 對應到前端是「計畫編號」嗎? 如果是的話也不能用 projectId,任何能修改的東西不應該當作 id 使用。

我剛剛去掃了目前的專案後發現一堆用 projectTitle 在當作參考的邏輯,整個處理完可能需要花掉一天,包含處理資料庫內現有的資料。
我覺得用 MongoDB 給的 _id 是比較好的,id 的產生其實是一件很複雜的事情,例如兩台機器同時產生大量 id 時會不會重複...等問題,交由資料庫系統處理比較好。

就依照 @cjk-halodule 說的將現有 Project.projectId 改名成 Project.adminProjectId,然後再開一個 Project.projectId 內容是由 MongoDB 產生的 unique id。

from camera-trap-api.

 avatar commented on July 19, 2024

3.1.3 的欄位就應該用新創的 adminProjectId 了 - 這個也得在前端的程式中更新
其它完全同意

from camera-trap-api.

oahehc avatar oahehc commented on July 19, 2024

同意以上做法

@diabloevagto 前端應該也有不少地方要同步調整, 再幫忙留意一下

from camera-trap-api.

 avatar commented on July 19, 2024

This has proceeded to nearly done. Reopen only when an issue emerges.

from camera-trap-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.