Skip to content

Commit

Permalink
fix(indexer): add guard for required entity fields
Browse files Browse the repository at this point in the history
  • Loading branch information
metmirr committed Jun 15, 2020
1 parent 6c9c274 commit df7570a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions substrate-query-framework/index-builder/src/db/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import { DeepPartial } from 'typeorm';
* @param entity: DeepPartial<T>
*/
export function fillRequiredWarthogFields<T>(entity: DeepPartial<T>): DeepPartial<T> {
// Modifying an existing entity so do not add warthog fields
if (entity.hasOwnProperty('id')) return entity;

const requiredFields = {
id: shortid.generate(),
createdById: shortid.generate(),
Expand Down

0 comments on commit df7570a

Please sign in to comment.