Skip to content

Commit

Permalink
fix: dont use short table aliases in raw query
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeg committed Apr 25, 2024
1 parent f86cb88 commit 43621ae
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/services/identity/CollaboratorsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,31 +235,31 @@ class CollaboratorsService {
// Basically with just:
// SELECT sm.role
// FROM
// site_members sm,
// repos r,
// site_members,
// repos,
// WHERE
// r.site_id = sm.site_id
// AND r.name = :siteName
// AND sm.user_id = :userId
// AND r.deleted_at IS NULL
// repos.site_id = site_members.site_id
// AND repos.name = :siteName
// AND site_members.user_id = :userId
// AND repos.deleted_at IS NULL

const records = (await this.sequelize.query(
`
SELECT sm.role
FROM
site_members sm,
sites s,
repos r,
users u
site_members,
sites,
repos,
users
WHERE
r.site_id = s.id
AND sm.site_id = s.id
AND r.name = :siteName
AND sm.user_id = u.id
AND sm.user_id = :userId
AND r.deleted_at IS NULL
AND s.deleted_at IS NULL
AND u.deleted_at IS NULL
repos.site_id = sites.id
AND site_members.site_id = sites.id
AND repos.name = :siteName
AND site_members.user_id = users.id
AND site_members.user_id = :userId
AND repos.deleted_at IS NULL
AND sites.deleted_at IS NULL
AND users.deleted_at IS NULL
`,
{
replacements: { siteName, userId },
Expand Down

0 comments on commit 43621ae

Please sign in to comment.