Skip to content

Commit

Permalink
disable isSingleLoc filter
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeKarow committed Feb 20, 2024
1 parent 433d553 commit a697ca8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 32 deletions.
17 changes: 9 additions & 8 deletions packages/api/router/orgEmail/query.forContactInfo.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ const isPublic = globalWhere.isPublic()
const whereId = (input: TForContactInfoSchema, isSingleLoc?: boolean): Prisma.OrgEmailWhereInput => {
switch (true) {
case isIdFor('organization', input.parentId): {
return isSingleLoc
? {
OR: [
{ organization: { some: { organization: { id: input.parentId, ...isPublic } } } },
{ locations: { some: { location: { organization: { id: input.parentId, ...isPublic } } } } },
],
}
: { organization: { some: { organization: { id: input.parentId, ...isPublic } } } }
return { organization: { some: { organization: { id: input.parentId, ...isPublic } } } }
// return isSingleLoc
// ? {
// OR: [
// { organization: { some: { organization: { id: input.parentId, ...isPublic } } } },
// { locations: { some: { location: { organization: { id: input.parentId, ...isPublic } } } } },
// ],
// }
// : { organization: { some: { organization: { id: input.parentId, ...isPublic } } } }
}
case isIdFor('orgLocation', input.parentId): {
return { locations: { some: { location: { id: input.parentId, ...isPublic } } } }
Expand Down
17 changes: 9 additions & 8 deletions packages/api/router/orgPhone/query.forContactInfo.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ const isPublic = globalWhere.isPublic()
const getWhereId = (input: TForContactInfoSchema, isSingleLoc?: boolean): Prisma.OrgPhoneWhereInput => {
switch (true) {
case isIdFor('organization', input.parentId): {
return isSingleLoc
? { organization: { organization: { id: input.parentId, ...isPublic } } }
: {
OR: [
{ organization: { organization: { id: input.parentId, ...isPublic } } },
{ locations: { some: { location: { organization: { id: input.parentId, ...isPublic } } } } },
],
}
return { organization: { organization: { id: input.parentId, ...isPublic } } }
// return isSingleLoc
// ? { organization: { organization: { id: input.parentId, ...isPublic } } }
// : {
// OR: [
// { organization: { organization: { id: input.parentId, ...isPublic } } },
// { locations: { some: { location: { organization: { id: input.parentId, ...isPublic } } } } },
// ],
// }
}
case isIdFor('orgLocation', input.parentId): {
return { locations: { some: { location: { id: input.parentId, ...isPublic } } } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ const isPublic = globalWhere.isPublic()
const whereId = (input: TForContactInfoSchema, isSingleLoc?: boolean): Prisma.OrgSocialMediaWhereInput => {
switch (true) {
case isIdFor('organization', input.parentId): {
return isSingleLoc
? { organization: { id: input.parentId, ...isPublic } }
: {
OR: [
{ organization: { id: input.parentId, ...isPublic } },
{ locations: { every: { location: { organization: { id: input.parentId, ...isPublic } } } } },
],
}
return { organization: { id: input.parentId, ...isPublic } }
// return isSingleLoc
// ? { organization: { id: input.parentId, ...isPublic } }
// : {
// OR: [
// { organization: { id: input.parentId, ...isPublic } },
// { locations: { every: { location: { organization: { id: input.parentId, ...isPublic } } } } },
// ],
// }
}
case isIdFor('orgLocation', input.parentId): {
return { locations: { some: { location: { id: input.parentId, ...isPublic } } } }
Expand Down
17 changes: 9 additions & 8 deletions packages/api/router/orgWebsite/query.forContactInfo.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ const isPublic = globalWhere.isPublic()
const whereId = (input: TForContactInfoSchema, isSingleLoc?: boolean): Prisma.OrgWebsiteWhereInput => {
switch (true) {
case isIdFor('organization', input.parentId): {
return isSingleLoc
? { organization: { id: input.parentId, ...isPublic } }
: {
OR: [
{ organization: { id: input.parentId, ...isPublic } },
{ locations: { every: { location: { organization: { id: input.parentId, ...isPublic } } } } },
],
}
return { organization: { id: input.parentId, ...isPublic } }
// return isSingleLoc
// ? { organization: { id: input.parentId, ...isPublic } }
// : {
// OR: [
// { organization: { id: input.parentId, ...isPublic } },
// { locations: { every: { location: { organization: { id: input.parentId, ...isPublic } } } } },
// ],
// }
}
case isIdFor('orgLocation', input.parentId): {
return { locations: { every: { location: { id: input.parentId, ...isPublic } } } }
Expand Down

1 comment on commit a697ca8

@vercel
Copy link

@vercel vercel bot commented on a697ca8 Feb 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.