Project id for user
This commit is contained in:
@@ -114,7 +114,6 @@ export async function getMe(req: AuthenticatedRequest, res: Response): Promise<v
|
||||
|
||||
const profile = await authService.getMe(userId);
|
||||
|
||||
// Transform avatarUrl to avatar_url for frontend compatibility
|
||||
res.status(200).json({
|
||||
success: true,
|
||||
data: {
|
||||
@@ -123,6 +122,7 @@ export async function getMe(req: AuthenticatedRequest, res: Response): Promise<v
|
||||
name: profile.name,
|
||||
role: profile.role,
|
||||
avatar_url: profile.avatarUrl,
|
||||
project_id: profile.projectId,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
@@ -28,6 +28,7 @@ export interface UserProfile {
|
||||
name: string;
|
||||
role: string;
|
||||
avatarUrl?: string | null;
|
||||
projectId?: string | null;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
@@ -230,9 +231,10 @@ export async function getMe(userId: string): Promise<UserProfile> {
|
||||
name: string;
|
||||
avatar_url: string | null;
|
||||
role_name: string;
|
||||
project_id: string | null;
|
||||
created_at: Date;
|
||||
}>(
|
||||
`SELECT u.id, u.email, u.name, u.avatar_url, r.name as role_name, u.created_at
|
||||
`SELECT u.id, u.email, u.name, u.avatar_url, r.name as role_name, u.project_id, u.created_at
|
||||
FROM users u
|
||||
JOIN roles r ON u.role_id = r.id
|
||||
WHERE u.id = $1 AND u.is_active = true
|
||||
@@ -252,6 +254,7 @@ export async function getMe(userId: string): Promise<UserProfile> {
|
||||
name: user.name,
|
||||
role: user.role_name,
|
||||
avatarUrl: user.avatar_url,
|
||||
projectId: user.project_id,
|
||||
createdAt: user.created_at,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user