Joystream / Joystream/hydra

An entity field must be set to null in order to be unset, yet model definitions don't allow it

Open
#435 1 comment 0 reactions 1 assignee View on GitHub

@ondratra is already working on this.

Since Sep 15, 2021.

estimate-12h low-prio
Dominant language
TypeScript
Stars
50
Forks
43
PR merge metrics
No merged PRs in 30d

Description

It looks like the neither setting a field to undefined nor using delete entity.field actually unsets the value in the database.
See: https://github.com/typeorm/typeorm/issues/2934

This conflicts with the TypeScript definitions of models generated by Hydra (warthog?), since they don't allow null as value even for optional fields.

For example:

export declare class MemberMetadata extends BaseModel {
    name?: string;
    avatar?: DataObject;
    about?: string;
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.