Support adding default auto generated attributes on all entities #87
-
I can see updatedAt but I invariably add createdAt for my entities. I cannot see this in the code. Something like this.
Would be nice to be able to do this simply on the entity annotation too. |
Beta Was this translation helpful? Give feedback.
Answered by
whimzyLive
Mar 19, 2021
Replies: 1 comment
-
@owain68 // Create a base entity with all the attributes you normally have
abstract class BaseEntity {
@AutoGenerateAttribute({
strategy: AUTO_GENERATE_ATTRIBUTE_STRATEGY.ISO_DATE
})
createdAt: string
}
// Create other entities from the base entity
class User extends BaseEntity {
@AutoGenerateAttribute({
strategy: AUTO_GENERATE_ATTRIBUTE_STRATEGY.UUID4
})
id: string
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
owain68
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@owain68
Hi, you can already achieve this today by leveraging entity inheritance.