feat: member portal Sprint 3 — profile edit form and privacy center

- PATCH /my/profile API endpoint (displayName, hometown, currentLocation, interests, language, digestPreference, directoryVisible)
- BFF PATCH /api/my/profile route
- ProfileForm client component: interest chips, digest preference, language, directory toggle
- Settings page rewrite: profile edit + privacy center (consent list + opt-out) + session + account delete

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-17 16:06:20 +05:30
parent bc9fe7c145
commit f7922454ca
5 changed files with 334 additions and 6 deletions
+14 -1
View File
@@ -1,4 +1,4 @@
import { Body, Controller, Delete, Get, Param, Post } from '@nestjs/common';
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common';
import { MyService } from './my.service';
import { MemberAuth } from '../auth/member-auth.decorator';
import { CurrentMember } from '../auth/current-member.decorator';
@@ -39,6 +39,19 @@ export class MyController {
return this.service.getProfile(member.sub, member.tenantId);
}
@Patch('profile')
updateProfile(@CurrentMember() member: MemberJwtPayload, @Body() body: {
displayName?: string;
hometown?: string;
currentLocation?: string;
interests?: string[];
language?: string;
digestPreference?: string;
directoryVisible?: boolean;
}) {
return this.service.updateProfile(member.sub, member.tenantId, body);
}
@Get('groups')
listGroups(@CurrentMember() member: MemberJwtPayload) {
return this.service.listGroups(member.sub, member.tenantId);
+33
View File
@@ -26,6 +26,39 @@ export class MyService {
};
}
async updateProfile(userId: string, tenantId: string, body: {
displayName?: string;
hometown?: string;
currentLocation?: string;
interests?: string[];
language?: string;
digestPreference?: string;
directoryVisible?: boolean;
}) {
const user = await this.prisma.towerUser.findFirst({ where: { id: userId, tenantId } });
if (!user) throw new NotFoundException('User not found');
const updated = await this.prisma.towerUser.update({
where: { id: userId },
data: {
...(body.displayName !== undefined && { displayName: body.displayName }),
...(body.hometown !== undefined && { hometown: body.hometown }),
...(body.currentLocation !== undefined && { currentLocation: body.currentLocation }),
...(body.interests !== undefined && { interests: body.interests }),
...(body.language !== undefined && { language: body.language }),
...(body.digestPreference !== undefined && { digestPreference: body.digestPreference }),
...(body.directoryVisible !== undefined && { directoryVisible: body.directoryVisible }),
},
select: {
id: true, jid: true, displayName: true, avatar: true,
hometown: true, currentLocation: true, interests: true,
language: true, digestPreference: true, directoryVisible: true,
},
});
return updated;
}
async getDigests(tenantId: string) {
const digests = await this.prisma.digest.findMany({
where: { tenantId },