diff --git a/src/pages/api/v1/network/[id]/member/[memberId]/index.ts b/src/pages/api/v1/network/[id]/member/[memberId]/index.ts index dc24695d..6bc343a6 100644 --- a/src/pages/api/v1/network/[id]/member/[memberId]/index.ts +++ b/src/pages/api/v1/network/[id]/member/[memberId]/index.ts @@ -65,7 +65,7 @@ const POST_updateNetworkMember = SecuredPrivateApiRoute( const validatedInput = updateableFieldsMetaSchema.parse(body); const updateableFields = { - name: { type: "string", destinations: ["controller", "database"] }, + name: { type: "string", destinations: ["database"] }, authorized: { type: "boolean", destinations: ["controller"] }, }; diff --git a/src/server/api/routers/memberRouter.ts b/src/server/api/routers/memberRouter.ts index fe0c8cd8..0a10c9e0 100644 --- a/src/server/api/routers/memberRouter.ts +++ b/src/server/api/routers/memberRouter.ts @@ -433,6 +433,7 @@ export const networkMemberRouter = createTRPCRouter({ }, }); } + // Check if the organization wants to update the node name globally if (input.organizationId && input.updateParams.name) { // Upsert OrganizationSettings to ensure it exists @@ -458,7 +459,7 @@ export const networkMemberRouter = createTRPCRouter({ }); } } - // if users click the re-generate icon on IP address + const response = await ctx.prisma.network.update({ where: { nwid: input.nwid, @@ -469,7 +470,7 @@ export const networkMemberRouter = createTRPCRouter({ where: { id_nwid: { id: input.id, - nwid: input.nwid, // this should be the value of `nwid` you are looking for + nwid: input.nwid, }, }, data: { diff --git a/src/server/api/services/memberService.ts b/src/server/api/services/memberService.ts index 10c837c4..a6e82702 100644 --- a/src/server/api/services/memberService.ts +++ b/src/server/api/services/memberService.ts @@ -40,6 +40,10 @@ export const syncMemberPeersAndStatus = async ( const activePreferredPath = findActivePreferredPeerPath(peers); const { physicalAddress, ...restOfDbMembers } = dbMember || {}; + // remove name from ztmember. + // !TODO: We dont update the member name from the controller, dont know if we should. + Reflect.deleteProperty(ztMember, "name"); + // Merge the data from the database with the data from Controller const updatedMember = { ...restOfDbMembers,