Change entity name("__en") field with custom property name #268
Replies: 3 comments
-
Hi @warren3billion, For the time being, I think you should consider storing "type" as an attribute on the entity with a default value specified as the entity name. const ORDER_ENTITY_IDENTIFIER = 'order';
@Entity({
name: ORDER_ENTITY_IDENTIFIER,
...
})
class Order {
@Attribute({default: ORDER_ENTITY_IDENTIFIER})
type: string
} |
Beta Was this translation helpful? Give feedback.
-
Hi guys, is there a way of removing this __en attribute when creating a new register? |
Beta Was this translation helpful? Give feedback.
-
no this can't be removed. It's a reserved attribute used by TypeDORM internally. |
Beta Was this translation helpful? Give feedback.
-
Each item created by this library has internal attribute
__en
I'd like to change this property's name because some of my service logics rely on the entity name and it assumes the property that shows type of entity would be named
type
.suppose I have an entity like below
I want the final record to be like this
Is there any way to get the entity name in the entity class or other walkarounds?
Beta Was this translation helpful? Give feedback.
All reactions