File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 11/**
22 * @module decorators
33 */
4+ import { createOptModelLogger } from '../../../logger/logger'
45import { PropertyMetadata } from '../../metadata/property-metadata.model'
56import { initOrUpdateProperty } from '../property/init-or-update-property.function'
67import { KEY_PROPERTY } from '../property/key-property.const'
78
9+ const logger = createOptModelLogger ( '@PartitionKey' )
10+
811export function PartitionKey ( ) : PropertyDecorator {
912 return ( target : any , propertyKey : string | symbol ) => {
1013 if ( typeof propertyKey === 'string' ) {
@@ -14,9 +17,11 @@ export function PartitionKey(): PropertyDecorator {
1417 const existingPartitionKeys = properties . filter ( property => property . key && property . key . type === 'HASH' )
1518 if ( existingPartitionKeys . length ) {
1619 if ( properties . find ( property => property . name === propertyKey ) ) {
17- // just ignore this and go on, somehow the partition key gets defined
18- // tslint:disable-next-line:no-console
19- console . warn ( `this is the second execution to define the partitionKey for property ${ propertyKey } ` )
20+ // just ignore this and go on, somehow the partition key gets defined two times
21+ logger . warn (
22+ `this is the second execution to define the partitionKey for property ${ propertyKey } ` ,
23+ target . constructor ,
24+ )
2025 } else {
2126 throw new Error (
2227 'only one partition key is allowed per model, if you want to define key for indexes use one of these decorators: ' +
You can’t perform that action at this time.
0 commit comments