class UserProjectsQueries: @staticmethod def get_user_projects( columns="dsp_id(project.source::text, coalesce(project.prs_project_code, project.ccp_project_code)) as project_id, dec_user.id as user_id", where_clause="project.is_deleted IS FALSE" ): return f""" select {columns} from "Project" project left join "UserProject" user_project ON user_project.project_id = project.id left join "ProjectTargetItem" project_target_item on ( project_target_item.project_id = project.id and project_target_item.entity_type = 0 and project_target_item.is_deleted is false and project_target_item.add_type = 2 and project.is_confidential is false ) left join "Artist" as artist on (artist.id = project_target_item.entity_id and artist.is_unknown is false) left join "ArtistTeam" as artist_team on (artist_team.artist_id = artist.id) left join "ArtistTeamUser" as artist_team_user on artist_team.id = artist_team_user.artist_team_id join "User" dec_user on ( dec_user.id = user_project.user_id or dec_user.id = project.owner_id or (dec_user.id = artist_team_user.user_id and project.is_confidential is false) ) where {where_clause} group by project.source, project.ccp_project_code, project.prs_project_code, dec_user.id """