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 1
1
/**
2
2
* @module decorators
3
3
*/
4
+ import { createOptModelLogger } from '../../../logger/logger'
4
5
import { PropertyMetadata } from '../../metadata/property-metadata.model'
5
6
import { initOrUpdateProperty } from '../property/init-or-update-property.function'
6
7
import { KEY_PROPERTY } from '../property/key-property.const'
7
8
9
+ const logger = createOptModelLogger ( '@PartitionKey' )
10
+
8
11
export function PartitionKey ( ) : PropertyDecorator {
9
12
return ( target : any , propertyKey : string | symbol ) => {
10
13
if ( typeof propertyKey === 'string' ) {
@@ -14,9 +17,11 @@ export function PartitionKey(): PropertyDecorator {
14
17
const existingPartitionKeys = properties . filter ( property => property . key && property . key . type === 'HASH' )
15
18
if ( existingPartitionKeys . length ) {
16
19
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
+ )
20
25
} else {
21
26
throw new Error (
22
27
'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