@@ -218,51 +218,49 @@ export default class MemberOrganizationsService extends LoggerBase {
218218 ) : Promise < IRenderFriendlyMemberOrganization [ ] > {
219219 const transaction = await SequelizeRepository . createTransaction ( this . options )
220220 const repositoryOptions = { ...this . options , transaction }
221-
221+
222222 try {
223223 const qx = SequelizeRepository . getQueryExecutor ( repositoryOptions )
224224
225225 const existing = await fetchMemberOrganizationById ( qx , id )
226226 if ( ! existing || existing . memberId !== memberId ) {
227227 throw new Error404 ( `Member organization with id ${ id } not found!` )
228228 }
229-
229+
230230 const hasDateStart = data . dateStart !== undefined
231231 const hasDateEnd = data . dateEnd !== undefined
232232 const targetDateRange = sanitizeMemberOrganizationDateRange (
233233 hasDateStart ? data . dateStart : existing . dateStart ,
234234 hasDateEnd ? data . dateEnd : existing . dateEnd ,
235235 true ,
236236 )
237-
237+
238238 const update = lodash . pickBy (
239239 {
240240 organizationId : data . organizationId ,
241241 title : data . title ,
242242 dateStart : hasDateStart ? targetDateRange . dateStart : undefined ,
243243 dateEnd : hasDateEnd ? targetDateRange . dateEnd : undefined ,
244- source : data . source ,
244+
245245 verified : data . verified ,
246246 verifiedBy : data . verifiedBy ,
247247 } ,
248248 ( v ) => v !== undefined ,
249249 ) as MemberOrganizationUpdate
250250
251- await cleanSoftDeletedMemberOrganization ( qx , memberId , data . organizationId , data )
252- // Any manual edit from the frontend promotes ownership to UI so automated
253- // sources (e.g. email-domain inference) no longer overwrite user intent.
251+ await cleanSoftDeletedMemberOrganization ( qx , memberId , data . organizationId , update )
254252 await updateMemberOrganization ( qx , memberId , id , {
255253 ...update ,
256- source : OrganizationSource . UI ,
254+ source : OrganizationSource . UI
257255 } )
258-
256+
259257 // Trigger recalculation for old and new orgs if changed
260258 const orgsToRecalculate = Array . from (
261259 new Set ( [ existing . organizationId , data . organizationId ] ) ,
262260 ) . filter ( ( orgId ) : orgId is string => Boolean ( orgId ) )
263261
264262 await this . commonMemberService . startAffiliationRecalculation ( memberId , orgsToRecalculate )
265-
263+
266264 const result = await this . list ( memberId , transaction )
267265
268266 await SequelizeRepository . commitTransaction ( transaction )
0 commit comments