loopbackio / loopbackio/loopback-next

Support auto-updated model properties "createdAt" and "updateAt"

オープン
#1,857 コメント 36 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

feature major Repository
主要言語
TypeScript
スター
5.1k
フォーク
1.1k
平均マージ
2日 21時間
マージ済み PR(30日)
27

説明

## Feature proposal
While creating a model/Entity from cli, I have an option to create a date field. A common example would be a user model with created_at and updated_at fields (or any variants of createdAt and updatedAt). Typically the behaviour is that on new resource creation, I would like to set the created_at and updated_at as the current time. on subsequent updates, I would like to update the updated_at timestamp with the time of operation.

Given that created_at needs to be populated at creation and updated_at needs to be updated with every modification, it can be a nice inbuilt feature to have with models where I can say that a particular field acts as created_at and another one as updated_at and loopback can take care of updating these fields, saving me some lines of code.

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、CLI から公開されている model/Entity の作成パスと、リソースの作成および更新時にモデルのプロパティがどのように処理されるかを追跡します。createdAt と updatedAt の各バリアントに対する意図した設定を確認し、作成時に両方のタイムスタンプが設定され、その後の変更では変更用タイムスタンプのみが更新されることを示すテストを定義します。

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

評価

技術スタック
node.js, typescript
領域
api, backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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