File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ type InstrumentQuery<TKind extends InstrumentKind> = {
4646@Injectable ( )
4747export class InstrumentsService {
4848 constructor (
49+ @InjectModel ( 'Group' ) private readonly groupModel : Model < 'Group' > ,
4950 @InjectModel ( 'Instrument' ) private readonly instrumentModel : Model < 'Instrument' > ,
5051 private readonly cryptoService : CryptoService ,
5152 private readonly loggingService : LoggingService ,
@@ -87,6 +88,21 @@ export class InstrumentsService {
8788 if ( ! result . success ) {
8889 throw new UnprocessableEntityException ( result . message ) ;
8990 }
91+ } else if ( instance . internal . edition > 1 ) {
92+ await this . groupModel . updateMany ( {
93+ data : {
94+ accessibleInstrumentIds : {
95+ push : [ id ]
96+ }
97+ } ,
98+ where : {
99+ accessibleInstrumentIds : {
100+ has : this . generateScalarInstrumentId ( {
101+ internal : { edition : instance . internal . edition - 1 , name : instance . internal . name }
102+ } )
103+ }
104+ }
105+ } ) ;
90106 }
91107
92108 await this . instrumentModel . create ( { data : { bundle, id } } ) ;
You can’t perform that action at this time.
0 commit comments