Skip to content

Commit

Permalink
member name
Browse files Browse the repository at this point in the history
  • Loading branch information
sinamics committed Sep 2, 2024
1 parent 8954aad commit d1087f8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/pages/api/v1/network/[id]/member/[memberId]/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"] },
};

Expand Down
5 changes: 3 additions & 2 deletions src/server/api/routers/memberRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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: {
Expand Down
4 changes: 4 additions & 0 deletions src/server/api/services/memberService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d1087f8

Please sign in to comment.