Permalink
Browse files

feat(Mapping): add auto field decorators

  • Loading branch information...
RWOverdijk committed Sep 25, 2018
1 parent 4fd566c commit 515ac29cb66931db06f86eff4b4180d80714b8c3
Showing with 33 additions and 0 deletions.
  1. +33 −0 src/decorators/Mapping.ts
@@ -115,6 +115,39 @@ export function primary() {
};
}
/**
* Convenience method that automatically sets a PK id.
*
* @returns {Mapping}
*/
export function autoPK() {
return (target: Object) => {
Mapping.forEntity(target).autoPK();
};
}
/**
* Convenience method that automatically sets a createdAt.
*
* @returns {Mapping}
*/
export function autoCreatedAt() {
return (target: Object) => {
Mapping.forEntity(target).autoCreatedAt();
};
}
/**
* Convenience method that automatically sets an updatedAt.
*
* @returns {Mapping}
*/
export function autoUpdatedAt() {
return (target: Object) => {
Mapping.forEntity(target).autoUpdatedAt();
};
}
/**
* Map generatedValues. Examples:
*

0 comments on commit 515ac29

Please sign in to comment.