Skip to content

Commit

Permalink
feat(backend): remove MyTable from tables query (#2020)
Browse files Browse the repository at this point in the history
We can not delete MyTable and we most likely don't want to give moderation right to my table to other users.
Each time we click on Join My Table we create a new Table so it is not needed in the My Tables list.
  • Loading branch information
Elweyn authored Sep 12, 2024
1 parent 52b219d commit 28dc9fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 31 deletions.
19 changes: 2 additions & 17 deletions backend/src/graphql/resolvers/TableResolver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2202,7 +2202,7 @@ describe('TableResolver', () => {
)
})

it('returns array for tables where user is owner', async () => {
it('returns empty array for tables where user is moderator', async () => {
await expect(
testServer.executeOperation(
{
Expand All @@ -2215,15 +2215,7 @@ describe('TableResolver', () => {
kind: 'single',
singleResult: {
data: {
tables: [
{
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
id: expect.any(Number),
name: 'My Table',
public: true,
users: [],
},
],
tables: [],
},
errors: undefined,
},
Expand Down Expand Up @@ -2266,13 +2258,6 @@ describe('TableResolver', () => {
singleResult: {
data: {
tables: [
{
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
id: expect.any(Number),
name: 'My Table',
public: true,
users: [],
},
{
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
id: expect.any(Number),
Expand Down
19 changes: 5 additions & 14 deletions backend/src/graphql/resolvers/TableResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,21 +303,12 @@ export class TableResolver {
const { user } = context
const dbMeetings = await prisma.meeting.findMany({
where: {
OR: [
{
user: {
id: user?.id,
},
},
{
users: {
some: {
userId: user?.id,
role: AttendeeRole.MODERATOR,
},
},
users: {
some: {
userId: user?.id,
role: AttendeeRole.MODERATOR,
},
],
},
},
include: {
users: true,
Expand Down

0 comments on commit 28dc9fa

Please sign in to comment.