@@ -48,11 +48,11 @@ export async function getWebPushCertificateInsertSerialOperations(
4848 deep,
4949 webPushCertificate,
5050 containValue,
51- containerLinkId,
5251 shouldMakeActive = false
5352 } = param ;
53+ const containerLinkId = param . containerLinkId !== null ? param . containerLinkId ?? deep . linkId : null ;
5454 const reservedLinkIds = await getReservedLinkIds ( ) ;
55- const { containLinkId, webPushCertificateLinkId, usesWebPushCertificateLinkId } = reservedLinkIds ;
55+ const { containForWebPushCertificateLinkId : containLinkId , webPushCertificateLinkId, usesWebPushCertificateLinkId, containForUsesWebPushCertificateLinkId } = reservedLinkIds ;
5656 const typeLinkIds = await getTypeLinkIds ( ) ;
5757 const { containTypeLinkId, webPushCertificateTypeLinkId , usesWebPushCertificateTypeLinkId} = typeLinkIds ;
5858 const serialOperations = [ ] ;
@@ -81,7 +81,7 @@ export async function getWebPushCertificateInsertSerialOperations(
8181 objects : {
8282 id : containLinkId ,
8383 type_id : containTypeLinkId ,
84- from_id : containerLinkId || deep . linkId ,
84+ from_id : containerLinkId ,
8585 to_id : webPushCertificateLinkId ,
8686 } ,
8787 } ) ;
@@ -109,6 +109,19 @@ export async function getWebPushCertificateInsertSerialOperations(
109109 } ,
110110 } )
111111 serialOperations . push ( usesWebPushCertificateInsertSerialOperation ) ;
112+ if ( containerLinkId !== null ) {
113+ const containForUsesWebPushCertificateInsertSerialOperation = createSerialOperation ( {
114+ type : 'insert' ,
115+ table : 'links' ,
116+ objects : {
117+ id : containForUsesWebPushCertificateLinkId ,
118+ type_id : containTypeLinkId ,
119+ from_id : containerLinkId ,
120+ to_id : usesWebPushCertificateLinkId ,
121+ }
122+ } )
123+ serialOperations . push ( containForUsesWebPushCertificateInsertSerialOperation ) ;
124+ }
112125 }
113126
114127 return {
@@ -125,22 +138,25 @@ export async function getWebPushCertificateInsertSerialOperations(
125138
126139 async function getReservedLinkIds ( ) : Promise < GetReservedLinkIdsResult > {
127140 let result : GetReservedLinkIdsResult = {
128- containLinkId : 0 ,
141+ containForWebPushCertificateLinkId : 0 ,
129142 webPushCertificateLinkId : 0 ,
130- usesWebPushCertificateLinkId : 0
143+ usesWebPushCertificateLinkId : 0 ,
144+ containForUsesWebPushCertificateLinkId : 0
131145 } ;
132146 const linksToReserveCount =
133147 Object . keys ( result ) . length -
134148 Object . keys ( param . reservedLinkIds || { } ) . length ;
135149 const reservedLinkIds : number [ ] =
136150 linksToReserveCount > 0 ? await deep . reserve ( linksToReserveCount ) : [ ] ;
137151 result = {
138- containLinkId :
139- param . reservedLinkIds ?. containLinkId ?? reservedLinkIds . pop ( ) ! ,
152+ containForWebPushCertificateLinkId :
153+ param . reservedLinkIds ?. containForWebPushCertificateLinkId ?? reservedLinkIds . pop ( ) ! ,
140154 webPushCertificateLinkId :
141155 param . reservedLinkIds ?. webPushCertificateLinkId ?? reservedLinkIds . pop ( ) ! ,
142156 usesWebPushCertificateLinkId :
143157 param . reservedLinkIds ?. usesWebPushCertificateLinkId ?? reservedLinkIds . pop ( ) ! ,
158+ containForUsesWebPushCertificateLinkId :
159+ param . reservedLinkIds ?. containForUsesWebPushCertificateLinkId ?? reservedLinkIds . pop ( ) ! ,
144160 } ;
145161 return result ;
146162 }
@@ -177,11 +193,15 @@ export interface GetWebPushCertificateInsertSerialOperationsParam {
177193 /**
178194 * Reserved link id for the contain
179195 */
180- containLinkId ?: number ;
196+ containForWebPushCertificateLinkId ?: number ;
181197 /**
182198 * Reserved link id for the usesWebPushCertificate
183199 */
184200 usesWebPushCertificateLinkId ?: number ;
201+ /**
202+ * Reserved link id for the contain for usesServiceAccount
203+ */
204+ containForUsesWebPushCertificateLinkId ?: number ;
185205 } ;
186206 /**
187207 * Link ids of types that will be used in the serial operations
0 commit comments