-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Conversation
BREAKING CHANGE: Any patient saved with friendly id will no longer map friendly id to the patient object, thus not displaying it in the UI or have it available for search fix #1876
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/hospitalrun/hospitalrun-frontend/io02fx1v0 |
Size Change: 0 B Total Size: 0 B |
99e6cdf
to
fd448d6
Compare
fd448d6
to
4b94d53
Compare
@@ -1,7 +1,10 @@ | |||
import { patients } from 'config/pouchdb' | |||
import PatientRepository from 'clients/db/PatientRepository' | |||
import Patient from 'model/Patient' | |||
import { fromUnixTime } from 'date-fns' | |||
import * as shortid from 'shortid' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might not need * as shortid
syntax since we have esModuleIntrop
. Try with just import shortid from 'shortid'
src/clients/db/PatientRepository.ts
Outdated
@@ -1,17 +1,11 @@ | |||
import * as shortid from 'shortid' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as before.
src/clients/db/Repository.ts
Outdated
@@ -47,8 +48,15 @@ export default class Repository<T extends AbstractDBModel> { | |||
} | |||
|
|||
async save(entity: T): Promise<T> { | |||
const currentTime = getTime(new Date()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really prefer saving dates in ISOString
. It has same properties of ordering like unix timestamp but it is more readable. Can you change it to toISOString everywhere?
src/clients/db/Repository.ts
Outdated
const savedEntity = await this.db.put({ | ||
_id: uuidv4(), | ||
...valuesToSave, | ||
createdDate: currentTime, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use what is the standard defacto for naming these fields:
createdDate
->createdAt
lastUpdatedDate
->updatedAt
And use ISOString as format, as I already pointed out.
LGTM! Nicely done. |
Fixes #1876
Fixes #1877
Fixes #1879
Changes proposed in this pull request:
Newly added dependencies with Bundlephobia links: