CenterForDigitalHumanities / CenterForDigitalHumanities/rerum_server_nodejs

Object Minting Utility for db-controller

オープン
#82 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
JavaScript
スター
3
フォーク
6
平均マージ
2日 47分
マージ済み PR(30日)
4

説明

This is an optimization idea.

Each of the actions have a moment like
```javascript
const id = new ObjectID().toHexString()
let generatorAgent = req.user[process.env.RERUM_AGENT_CLAIM] ?? "http://dev.rerum.io/agent/CANNOTBESTOPPED"
let context = req.body["@context"]?{"@context":req.body["@context"]}:{}
let provided = JSON.parse(JSON.stringify(req.body))
let rerumProp = {"__rerum":utils.configureRerumOptions(generatorAgent, provided, false, false)["__rerum"]}
delete provided["_rerum"]
delete provided["_id"]
delete provided["@id"]
delete provided["@context"]
let newObject = Object.assign(context, {"@id":process.env.RERUM_ID_PREFIX + id}, provided, rerumProp, {"_id":id})
```
where this code is ALMOST a direct C&P, but not quite so it will take a little focus and thought. This can probably be a utility function, JSON in - JSON Out with some strategic flags to make sure to support the slight differences between actions

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

db-controller 内で、示されているオブジェクト生成シーケンスを繰り返している action handler を特定し、それぞれの小さな違いを比較します。これらの使用箇所から utility の JSON 入力、出力、および戦略フラグを定義します。繰り返されているオブジェクト生成ロジックが統合され、各 action が必要な動作を維持していれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
backend
issue の種類
リファクタリング
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。