Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ workflows:
- develop
- pm-1127_1
- PM-4305
- PM-4491-fix
- PM-4490

# Production builds are exectuted only on tagged commits to the
# master branch.
Expand Down
15 changes: 15 additions & 0 deletions sql/reports/identity/users-by-handles.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ WITH input_handles AS (
SELECT
ih.handle_input AS "handle",
u.user_id AS "userId",
NULLIF(TRIM(mem."firstName"), '') AS "firstName",
NULLIF(TRIM(mem."lastName"), '') AS "lastName",
NULLIF(TRIM(ph.phone_number::text), '') AS "contactNumber",
pe.address AS "email",
COALESCE(
NULLIF(BTRIM(mem."competitionCountryCode"), ''),
Expand All @@ -24,6 +27,18 @@ LEFT JOIN LATERAL (
LIMIT 1
) AS pe
ON TRUE
LEFT JOIN LATERAL (
SELECT p."number" AS phone_number
FROM members."memberPhone" AS p
WHERE p."userId" = u.user_id
AND NULLIF(TRIM(p."number"::text), '') IS NOT NULL
ORDER BY
(p."type" = 'HOME') DESC,
p."createdAt" DESC NULLS LAST,
p."id" ASC
LIMIT 1
) AS ph
ON TRUE
LEFT JOIN members."member" AS mem
ON mem."userId" = u.user_id
ORDER BY ih.ordinality;
3 changes: 3 additions & 0 deletions src/reports/identity/dtos/identity-users.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ export class UsersByGroupQueryDto {
export interface IdentityUserDto {
userId: number | null;
handle: string;
firstName: string | null;
lastName: string | null;
contactNumber: string | null;
email: string | null;
country: string | null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/reports/identity/identity-reports.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class IdentityReportsController {
@ApiBearerAuth()
@ApiOperation({
summary:
"Export user details (ID, handle, email, country) for a list of handles",
"Export user details (ID, handle, firstName, lastName, contactNumber, email, country) for a list of handles",
})
@ApiConsumes("application/json", "multipart/form-data")
@ApiBody({
Expand Down
6 changes: 6 additions & 0 deletions src/reports/identity/identity-reports.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const SUPPORTED_HANDLES_UPLOAD_EXTENSIONS = new Set([".txt", ".csv"]);
type UsersByHandlesRow = {
userId: number | null;
handle: string;
firstName: string | null;
lastName: string | null;
contactNumber: string | null;
email: string | null;
country: string | null;
};
Expand Down Expand Up @@ -114,6 +117,9 @@ export class IdentityReportsService {
return results.map((row) => ({
userId: row.userId,
handle: row.handle,
firstName: row.firstName,
lastName: row.lastName,
contactNumber: row.contactNumber,
email: row.email,
country: alpha3ToCountryName(row.country) ?? row.country,
}));
Expand Down
2 changes: 1 addition & 1 deletion src/reports/report-directory.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ const REGISTERED_REPORTS_DIRECTORY: RegisteredReportsDirectory = {
identityPostReport(
"Users by Handles",
"/identity/users-by-handles",
"Export user ID, handle, email, and country for each supplied handle; unknown handles return empty fields",
"Export user ID, handle, firstName, lastName, contactNumber, email, and country for each supplied handle; unknown handles return empty fields",
AppScopes.Identity.UsersByHandles,
[handlesBodyParam],
),
Expand Down
Loading