mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 02:06:19 +01:00
Remove sensitive user information.
This commit is contained in:
parent
6d5aeb3bd1
commit
44e6bff6b1
@ -19,13 +19,20 @@ export async function getTeamUser(teamId: string, userId: string): Promise<TeamU
|
||||
});
|
||||
}
|
||||
|
||||
export async function getTeamUsers(teamId: string): Promise<TeamUser[]> {
|
||||
export async function getTeamUsers(
|
||||
teamId: string,
|
||||
): Promise<(TeamUser & { user: { id: string; username: string } })[]> {
|
||||
return prisma.client.teamUser.findMany({
|
||||
where: {
|
||||
teamId,
|
||||
},
|
||||
include: {
|
||||
user: true,
|
||||
user: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { TeamWebsite, Prisma, Website, Team, User } from '@prisma/client';
|
||||
import { TeamWebsite, Prisma, Website, Team, User, TeamUser } from '@prisma/client';
|
||||
import { ROLES } from 'lib/constants';
|
||||
import { uuid } from 'lib/crypto';
|
||||
import prisma from 'lib/prisma';
|
||||
@ -38,9 +38,9 @@ export async function getTeamWebsiteByTeamMemberId(
|
||||
|
||||
export async function getTeamWebsites(teamId: string): Promise<
|
||||
(TeamWebsite & {
|
||||
team: Team;
|
||||
team: Team & { teamUser: TeamUser[] };
|
||||
website: Website & {
|
||||
user: User;
|
||||
user: { id: string; username: string };
|
||||
};
|
||||
})[]
|
||||
> {
|
||||
@ -60,7 +60,12 @@ export async function getTeamWebsites(teamId: string): Promise<
|
||||
},
|
||||
website: {
|
||||
include: {
|
||||
user: true,
|
||||
user: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Prisma, Team } from '@prisma/client';
|
||||
import { Prisma, Team, TeamUser } from '@prisma/client';
|
||||
import cache from 'lib/cache';
|
||||
import { ROLES } from 'lib/constants';
|
||||
import prisma from 'lib/prisma';
|
||||
@ -40,7 +40,13 @@ export async function getUsers(): Promise<User[]> {
|
||||
});
|
||||
}
|
||||
|
||||
export async function getUserTeams(userId: string): Promise<Team[]> {
|
||||
export async function getUserTeams(userId: string): Promise<
|
||||
(Team & {
|
||||
teamUser: (TeamUser & {
|
||||
user: { id: string; username: string };
|
||||
})[];
|
||||
})[]
|
||||
> {
|
||||
return prisma.client.team.findMany({
|
||||
where: {
|
||||
teamUser: {
|
||||
@ -52,7 +58,12 @@ export async function getUserTeams(userId: string): Promise<Team[]> {
|
||||
include: {
|
||||
teamUser: {
|
||||
include: {
|
||||
user: true,
|
||||
user: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user