Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2191628
Issue #000 fix: creating usres in bulk - TypeError: Cannot read prope…
vaivk369 Dec 28, 2025
e9c332b
Merge branch 'develop' of github.com:ELEVATE-Project/user into new-dev
vaivk369 Jan 7, 2026
b0ece15
Create brac-dev-deployment.yaml
AbhilashKD Jan 10, 2026
ce6e552
Update brac-dev-deployment.yaml
AbhilashKD Jan 10, 2026
2321f18
Update brac-dev-deployment.yaml
AbhilashKD Jan 10, 2026
cbfbef4
Update brac-dev-deployment.yaml
AbhilashKD Jan 10, 2026
a3555d9
Issue#252552 Feat: User bulk upload with all entity types
Sachintechjoomla Jan 16, 2026
b1b9d7d
Issue#252552 Feat: User bulk upload with all entity types
Sachintechjoomla Jan 16, 2026
538b6f3
Issue #000 fix: added new endpoint to create account in teanat and de…
vaivk369 Jan 21, 2026
04a4422
Merge pull request #2 from vaivk369/new-dev
vaivk369 Jan 21, 2026
7af866c
Export AWS secret access keys in deployment workflow
AbhilashKD Jan 21, 2026
0c2044f
Fix AWS credentials export in deployment workflow
AbhilashKD Jan 21, 2026
5cdfc32
Update brac-dev-deployment.yaml
AbhilashKD Jan 21, 2026
6f2b83a
Issue #000 fix: serach Users with one or more meta params
vaivk369 Jan 29, 2026
ebb05b7
Merge pull request #3 from vaivk369/new-dev
vaivk369 Jan 29, 2026
76fefc4
Added QA Deployment Pipeline
Jan 29, 2026
bdba95c
Udated the env varibales setup
Jan 29, 2026
b705434
Updated the Building Guidelinces
Jan 29, 2026
768cf9f
Updated the dev
Jan 29, 2026
5ccb17c
Issue#253287 Feat: User account search API > Add status filter
Sachintechjoomla Feb 2, 2026
9b0ade2
Merge branch 'develop' of github.com:tekdi/brac-elevate-user-service …
Sachintechjoomla Feb 2, 2026
10bf753
Merge pull request #4 from Sachintechjoomla/Issue#253287
vaivk369 Feb 2, 2026
07cc88d
Merge branch 'develop' of github.com:tekdi/brac-elevate-user-service …
Sachintechjoomla Feb 2, 2026
3e6bf26
Merge pull request #1 from Sachintechjoomla/Issue#252552
vaivk369 Feb 2, 2026
4fc8628
Profile read while creating project giving error
vaivk369 Feb 10, 2026
fe0b2b2
Merge pull request #5 from vaivk369/new-dev
vaivk369 Feb 10, 2026
2d9034f
Issue#254093 Feat: Update > LC update participant address
Sachintechjoomla Feb 19, 2026
8e86362
Merge pull request #8 from Sachintechjoomla/Issue#254093
vaibhavsTekdi Feb 20, 2026
dc436d8
Issue #000 fix: update user profile added
vaivk369 Mar 1, 2026
23fb210
Merge pull request #10 from vaivk369/vk-updateUser
vaivk369 Mar 1, 2026
f531c84
Issue #000 fix: allow supervisors to login through Admin flow- i.e. a…
vaivk369 Apr 7, 2026
c47245a
Merge pull request #13 from vaivk369/vk-updateUser
vaivk369 Apr 7, 2026
28935b4
Issue#258700 Fix: User Not able to Import via bulkImport
Sachintechjoomla May 25, 2026
479a5b7
Issue#258700 Fix: User Not able to Import via bulkImport
Sachintechjoomla May 25, 2026
9715d19
Merge pull request #15 from Sachintechjoomla/Issue#258700
vaivk369 May 25, 2026
d65fc5a
Issue#261206 Fix: Whle updateUser from Admin then phone and email sto…
Sachintechjoomla Jul 15, 2026
c438f51
Issue#261206 Fix: address review comments on phone encryption
Sachintechjoomla Jul 15, 2026
56fc9d6
Issue#261206 Fix: Whle updateUser from Admin then phone and email st…
Sachintechjoomla Jul 16, 2026
3807904
Issue#261206 Fix: Whle updateUser from Admin then phone and email sto…
Sachintechjoomla Jul 16, 2026
0b12e48
Issue#261206 Fix: Whle updateUser from Admin then phone and email sto…
Sachintechjoomla Jul 16, 2026
0078f21
Issue#261206 Fix: Whle updateUser from Admin then phone and email sto…
Sachintechjoomla Jul 16, 2026
c9c2beb
Issue#261206 Fix: Whle updateUser from Admin then phone and email sto…
Sachintechjoomla Jul 16, 2026
f37f40f
Issue#261206 Fix: Whle updateUser from Admin then phone and email sto…
Sachintechjoomla Jul 16, 2026
b2ff855
Issue#261206 Fix: While updateUser from Admin then phone and email st…
Sachintechjoomla Jul 16, 2026
de41a21
Issue#261206 Fix: Whle updateUser from Admin then phone and email sto…
Sachintechjoomla Jul 16, 2026
415ceff
Issue#261206 Fix: Whle updateUser from Admin then phone and email sto…
Sachintechjoomla Jul 16, 2026
38b9c01
Issue#261206 Fix: Whle updateUser from Admin then phone and email sto…
Sachintechjoomla Jul 16, 2026
2b5b962
Issue#261206 Fix: While updateUser from Admin then phone and email st…
Sachintechjoomla Jul 16, 2026
9e173f0
Issue#261206 Fix: While updateUser from Admin then phone and email st…
Sachintechjoomla Jul 16, 2026
71a4dbe
Issue#261206 Fix: While updateUser from Admin then phone and email st…
Sachintechjoomla Jul 16, 2026
dd2b76e
Issue#261206 Fix: While updateUser from Admin then phone and email st…
Sachintechjoomla Jul 16, 2026
e6688e5
Issue#261206 Fix: While updateUser from Admin then phone and email st…
Sachintechjoomla Jul 16, 2026
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
86 changes: 86 additions & 0 deletions .github/workflows/brac-dev-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Dev Build & Deploy User Service (BRAC)

on:
push:
branches:
- develop

env:
AWS_REGION: ${{ secrets.AWS_REGION }}
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_BRAC }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}

jobs:
build-and-deploy:
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4

# =========================
# AWS Authentication
# =========================
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

# =========================
# Login to Amazon ECR
# =========================
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2

# =========================
# Build & Push Image
# =========================
- name: Build and Push Docker Image to ECR
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.ECR_REPOSITORY }}:latest-brac
${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.ECR_REPOSITORY }}:${{ github.sha }}
# =========================
# Deploy on Server
# =========================
- name: Deploy Stack
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST_NAME_DEV }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.PORT }}
script: |
set -e

# Export AWS variables
export AWS_REGION="${{ secrets.AWS_REGION }}"
export AWS_ACCOUNT_ID="${{ secrets.AWS_ACCOUNT_ID }}"
#export aws-access-key-id="${{ secrets.AWS_ACCESS_KEY_ID }}"
#export aws-secret-access-key="${{ secrets.AWS_SECRET_ACCESS_KEY }}"
cd ${{ secrets.TARGET_DIR_DEV }}

# Backup old env if exists
if [ -f .env ]; then
mv .env .env-bkp
fi

# Write env safely (MULTILINE SAFE)
cat << 'EOF' > .env
${{ secrets.DEV_ENV_BRAC }}
EOF

# Login to ECR (non-interactive)
aws ecr get-login-password --region "$AWS_REGION" \
| docker login --username AWS \
--password-stdin "$AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com"

./deploy.sh
87 changes: 87 additions & 0 deletions .github/workflows/brac-qa-deplyment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Tag Build & Deploy User Service (BRAC)

on:
push:
tags:
- "v*"

env:
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_BRAC }}
TAG: ${{ github.ref_name }}

jobs:
build-and-deploy:
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4

# =========================
# AWS Authentication
# =========================
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

# =========================
# Login to Amazon ECR
# =========================
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2

# =========================
# Build & Push Docker Image
# =========================
- name: Build and Push Docker Image to ECR
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.ECR_REPOSITORY }}:${{ env.TAG }}

# =========================
# Deploy on QA Server
# =========================
- name: Deploy Stack to QA
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST_NAME_QA }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.EC2_KEY }}
port: ${{ secrets.PORT }}
script: |
set -e

export AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}
export AWS_REGION=${{ env.AWS_REGION }}

cd ${{ secrets.TARGET_DIR_QA }}

# Backup old env if exists
if [ -f .env ]; then
mv .env .env-bkp
fi

# Write env safely (MULTILINE SAFE)
cat << 'EOF' > .env
${{ secrets.QA_ENV_BRAC }}
EOF

aws ecr get-login-password --region ${AWS_REGION} \
| docker login \
--username AWS \
--password-stdin \
${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${AWS_REGION}.amazonaws.com

./deploy.sh ${{ env.TAG }}
182 changes: 182 additions & 0 deletions src/api-doc/bulkUser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# Bulk User Creation Guide

This guide provides step-by-step instructions for performing bulk user creation in the Elevate User Service.

## Prerequisites

- Valid JWT token with admin privileges
- CSV file containing user data in the required format
- Access to the API endpoints

## CSV Format

Your CSV file must include the following columns (case-sensitive):

```
name,email,phone_code,phone,username,password,roles,province,district,local_municipality,linkageChampion,supervisor
```

### Sample CSV Content

```
name,email,phone_code,phone,username,password,roles,province,district,local_municipality,linkageChampion,supervisor
Farabi Ahmedullah,[email protected],91,7012345499,farabi,Password@123,session_manager,SA-EC,SA-EC-ALFR,SA-EC-ALFR-MATA,,amolp
Carol Miranda,[email protected],91,7012345599,carol,Password@123,session_manager,SA-EC,SA-EC-ALFR,SA-EC-ALFR-MATA,,amolp
Amol Patil,amol,[email protected],91,7012345699,amolp,Password@123,org_admin,SA-EC,SA-EC-ALFR,SA-EC-ALFR-MATA,,
Suvarna Kale,[email protected],91,7012345699,suvarna,Password@123,user,SA-EC,SA-EC-ALFR,SA-EC-ALFR-MATA,,farabi
```

### Field Descriptions

- `name`: User's full name (required)
- `email`: User's email address (required if phone not provided)
- `phone_code`: Country code for phone (e.g., 91 for India)
- `phone`: User's phone number (required if email not provided)
- `username`: Desired username (optional, system will generate if not provided)
- `password`: User's password (required for direct creation, not for invitations)
- `roles`: Comma-separated list of roles (e.g., "session_manager,org_admin")
- Additional columns like `province`, `district`, etc., are for metadata

## Step-by-Step Process

### Step 1: Get Signed URL for File Upload

First, obtain a signed URL to upload your CSV file to cloud storage.

**Endpoint:** `GET /v1/cloud-services/file/getSignedUrl`

**Query Parameters:**

- `fileName`: Name of your CSV file (e.g., `bulk_users.csv`)

**Headers:**

- `X-auth-token`: Your JWT token

**Example Request:**

```bash
curl --location '{{baseURL}}user/v1/cloud-services/file/getSignedUrl?fileName=bulk_users.csv' \
--header 'X-auth-token: YOUR_JWT_TOKEN'
```

**Response:**

```json
{
"success": true,
"message": "SIGNED_URL_GENERATED_SUCCESSFULLY",
"result": {
"signedUrl": "https://your-cloud-storage-url...",
"filePath": "users/YOUR_USER_ID-TIMESTAMP-bulk_users.csv",
"destFilePath": "users/YOUR_USER_ID-TIMESTAMP-bulk_users.csv"
}
}
```

### Step 2: Upload CSV File

Upload your CSV file to the signed URL obtained in Step 1.

**Example Request:**

```bash
curl -X PUT -T /path/to/your/bulk_users.csv 'SIGNED_URL_FROM_STEP_1'
```

**Note:** Replace `/path/to/your/bulk_users.csv` with the actual path to your CSV file, and use single quotes around the signed URL to prevent shell interpretation of special characters.

### Step 3: Perform Bulk User Creation

Call the bulk user creation endpoint with the file path from Step 1.

**Endpoint:** `POST /v1/tenant/bulkUserCreate`

**Headers:**

- `X-auth-token`: Your JWT token
- Organization code header (configurable via `ORG_CODE_HEADER_NAME` env var, defaults to `x-org-code`): Your organization code (e.g., `brac_gbl`)
- Tenant code header (configurable via `TENANT_CODE_HEADER_NAME` env var, defaults to `x-tenant-code`): Your tenant code (e.g., `brac`)
- `Content-Type`: `application/json`

**Note on Headers:** The header names for organization and tenant codes are configurable through environment variables:

- `ORG_CODE_HEADER_NAME=organization` (current setting)
- `TENANT_CODE_HEADER_NAME=tenant` (current setting)

If these are not set, the defaults are `x-org-code` and `x-tenant-code`. Use the appropriate header names based on your environment configuration.

**Request Body:**

```json
{
"file_path": "users/YOUR_USER_ID-TIMESTAMP-bulk_users.csv",
"editable_fields": ["name", "email"],
"upload_type": "CREATE"
}
```

**Example Request:**

```bash
curl --location 'http://localhost:3567/user/v1/tenant/bulkUserCreate' \
--header 'Content-Type: application/json' \
--header 'X-auth-token: YOUR_JWT_TOKEN' \
--header 'organization: brac_gbl' \
--header 'tenant: brac' \
--data '{
"file_path" : "users/YOUR_USER_ID-TIMESTAMP-bulk_users.csv",
"editable_fields" : ["name"],
"upload_type": "CREATE"
}'
```

**Note:** The header names `organization` and `tenant` match the current environment variable settings. If your environment uses different header names (e.g., `x-org-code`, `x-tenant-code`), update the curl command accordingly.

**Response:**

```json
{
"success": true,
"message": "USER_CSV_UPLOADED",
"result": {
"id": 123,
"name": "bulk_users.csv",
"input_path": "users/YOUR_USER_ID-TIMESTAMP-bulk_users.csv",
"type": "CSV",
"organization_id": 66,
"created_by": 3074,
"tenant_code": "brac",
"uploadType": "CREATE",
"status": "PENDING",
"created_at": "2025-12-26T06:31:24.000Z",
"updated_at": "2025-12-26T06:31:24.000Z"
}
}
```

## Processing and Results

- The bulk upload is processed asynchronously via a background queue.
- You will receive an email notification with a download link to the results CSV once processing is complete.
- The results CSV will contain the status of each user creation/update attempt.

## Upload Types

- `"CREATE"`: Directly creates user accounts with provided passwords
- `"UPLOAD"`: Creates users and sends invitation emails
- `"INVITE"`: Sends invitation emails without creating accounts

## Troubleshooting

- **404 Error on Download**: Ensure the CSV file was successfully uploaded to the signed URL in Step 2.
- **Validation Errors**: Check that your CSV format matches the sample and all required fields are present.
- **Permission Denied**: Ensure your JWT token has admin privileges for the specified tenant and organization.
- **Expired Signed URL**: Signed URLs expire after 15 minutes. If expired, repeat Step 1.

## Additional Notes

- The process supports up to 1000 users per CSV file.
- Duplicate emails/phones will be handled based on existing user records.
- System-generated usernames will be assigned if not provided or if conflicts occur.
- All operations are logged and can be audited.
Loading