Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e8cf7e8
fix: added gratitude to Action interface
AlexVOiceover Mar 21, 2025
d72bf86
fix: adjusted gratitudeApi to use new Action interface
AlexVOiceover Mar 21, 2025
cad3602
fix: modified z-index to make tour popover on top of header
AlexVOiceover Mar 21, 2025
17f195a
feat: added driver tour
AlexVOiceover Mar 23, 2025
ef8798f
fix: typescript errors on useTour
AlexVOiceover Mar 23, 2025
462d7a3
style: adjust sizes for mobile
AlexVOiceover Mar 23, 2025
1bb7842
style: Removed chevron right on questions
AlexVOiceover Mar 23, 2025
5c7c9aa
fix: FilterBar will be conditionally rendered on small displays
AlexVOiceover Mar 23, 2025
9c49e2c
style: conditional styled privacy on wizard
AlexVOiceover Mar 23, 2025
5f1f166
fix: restyle statement menu
AlexVOiceover Mar 23, 2025
294a77b
style: set lower cut point for changing actions button in 2 rows
AlexVOiceover Mar 23, 2025
b5ea82c
Style: actions shown as tab
AlexVOiceover Mar 23, 2025
d3bd9f1
feat: added xs screen size on tailwind
AlexVOiceover Mar 23, 2025
e3c980f
style: use brand colors for actions group border
AlexVOiceover Mar 23, 2025
1251bea
style: make statement for mobile aligned properly
AlexVOiceover Mar 23, 2025
eef0c3e
fix: fixed syle for gratitud
AlexVOiceover Mar 23, 2025
493da17
fix: simplified font color selection on verbTiles
AlexVOiceover Mar 23, 2025
87a4e66
feat: style category
AlexVOiceover Mar 23, 2025
02ef09a
feat: added userEmail to context for use on fetches
AlexVOiceover Mar 24, 2025
22aa41e
feat: added dynamic sizes and transitions to edit username and manage…
AlexVOiceover Mar 24, 2025
292f578
style: removed allowedVerbs on questions
AlexVOiceover Mar 24, 2025
9868ef8
feat: changed order of category to populate descriptors on subjects
AlexVOiceover Mar 24, 2025
88e7737
feat: created welcome panel
AlexVOiceover Mar 25, 2025
57ebabe
feat: animation on help button when close help panel
AlexVOiceover Mar 25, 2025
8e0147a
feat: welcome panel get its text from helpContent.json
AlexVOiceover Mar 25, 2025
d627561
style: make help button similar to email one
AlexVOiceover Mar 26, 2025
9446e6e
fix: typescript errors fixed
AlexVOiceover Mar 26, 2025
5bc5b4b
style: style welcome pannel
AlexVOiceover Mar 26, 2025
67d3f72
fix: fixed email from magic Link not being passed to context
AlexVOiceover Mar 26, 2025
77d5cb7
fix: testing menu opacity
AlexVOiceover Mar 26, 2025
6074010
style: same style for email and help buttons
AlexVOiceover Mar 26, 2025
7232232
style: reword the h1 and restyle it
AlexVOiceover Mar 26, 2025
3bec717
style: same style for editing username that manager's
AlexVOiceover Mar 26, 2025
9cae85a
fix: removed unsused input
AlexVOiceover Apr 2, 2025
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
208 changes: 208 additions & 0 deletions GRATITUDE_API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
# Gratitude API

## Overview

The Gratitude feature allows users to send appreciation messages to others when marking actions as completed. This functionality enhances the collaborative nature of the application by enabling users to acknowledge contributions and express thanks to colleagues, managers, or team members.

## API Endpoints

### 1. Send Gratitude Email Endpoint

- **URL**: `/api/gratitude/send`
- **Method**: POST
- **Content-Type**: application/json
- **Credentials**: include
- **Request Body**:
```json
{
"statementId": "string", // ID of the statement containing the action
"actionId": "string", // ID of the specific action
"message": "string", // The gratitude message to send
"recipientEmail": "string", // Email address of the recipient
"recipientName": "string" // Optional name of the recipient
}
```
- **Expected Response**:

- Success:
```json
{
"success": true,
"message": "Gratitude email sent successfully",
"id": "string" // Unique ID for the sent message (for tracking)
}
```
- Error:
```json
{
"success": false,
"message": "Error description"
}
```

- **Backend Behavior**:
- Validate all inputs, especially the email format
- Compose an email using an appropriate template
- Include the gratitude message in the email
- Send the email to the recipient
- Return success confirmation with a unique ID
- Handle failures gracefully with meaningful error messages

### 2. Mark Gratitude Sent Endpoint

- **URL**: `/api/gratitude/mark/{statementId}/{actionId}`
- **Method**: POST
- **Content-Type**: application/json
- **Credentials**: include
- **URL Parameters**:
- `statementId`: The ID of the statement
- `actionId`: The ID of the action
- **Request Body**:
```json
{
"message": "string" // The gratitude message that was sent
}
```
- **Expected Response**:

- Success: Return the updated Action object:
```json
{
"id": "string", // Action ID
"creationDate": "string", // ISO date string
"byDate": "string", // ISO date string (can be empty)
"action": "string", // Action text
"completed": true, // Should be true for gratitude to be sent
"gratitudeSent": true, // Must be set to true
"gratitudeMessage": "string", // The message that was sent
"gratitudeSentDate": "string" // Current timestamp in ISO format
}
```
- Error:
```json
{
"success": false,
"message": "Error description"
}
```

- **Backend Behavior**:
- Verify the statement and action exist
- Update the action record with gratitude information
- Set the `gratitudeSent` flag to true
- Store the gratitude message
- Record the current timestamp as the sent date
- Return the complete updated action object

## Feature Flow

The Gratitude feature flow in the LIFT frontend consists of the following steps:

1. **Initiating Gratitude**

- User completes an action
- User clicks the dropdown menu for the action
- User selects "Send gratitude" option
- System displays the GratitudeModal

2. **Composing the Message**

- User enters recipient email
- User enters gratitude message
- System validates inputs
- User submits the form

3. **Sending the Gratitude**

- System calls the `/api/gratitude/send` endpoint
- Email is sent to the recipient
- System calls the `/api/gratitude/mark/{statementId}/{actionId}` endpoint
- Action is updated with gratitude information

4. **Visual Feedback**
- System displays success confirmation
- Action UI updates to show gratitude was sent
- Dropdown menu options are updated
- Tooltips display gratitude information

## Mock Implementation

For development and testing purposes, the frontend includes a mock implementation:

- Controlled by the environment variable `VITE_MOCK_EMAIL_SENDING`
- When enabled, simulates the API responses without real backend
- Logs details to console for debugging
- Includes realistic delays to simulate network latency

To use the mock implementation:

1. Set `VITE_MOCK_EMAIL_SENDING=true` in your environment
2. The frontend will use the mock implementations in `gratitudeApi.ts`
3. No actual emails will be sent, but the UI will behave as if they were

## Security Considerations

When implementing the Gratitude API endpoints, consider the following security aspects:

1. **Input Validation**

- Validate email formats
- Sanitize message content to prevent injection
- Validate that IDs exist and belong to the requesting user

2. **Authorization**

- Ensure users can only send gratitude for actions they have access to
- Implement proper authentication checks
- Verify user permissions before processing requests

3. **Rate Limiting**

- Implement rate limiting to prevent abuse
- Consider limits like maximum 10 emails per hour per user
- Add exponential backoff for repeated failures

4. **Email Security**

- Ensure proper email headers
- Prevent header injection
- Include unsubscribe options
- Follow email sending best practices

5. **Logging**
- Log all gratitude emails sent for auditing
- Track failures and errors
- Monitor for unusual patterns

## Testing the Integration

When testing the integration between frontend and backend:

1. **Verify Email Sending**

- Test with valid and invalid email addresses
- Confirm emails are received by recipients
- Check email content and formatting

2. **Test State Updates**

- Ensure action records are properly updated
- Verify timestamps are accurate
- Confirm UI updates correctly after sending

3. **Error Handling**

- Test with various error scenarios
- Verify user-friendly error messages
- Ensure system recovers gracefully from failures

4. **Edge Cases**
- Test with very long messages
- Test with special characters
- Test with high volume of requests

## Conclusion

The Gratitude API enhances the LIFT application by enabling users to express appreciation for completed actions. When implemented correctly, it creates a positive feedback loop within teams and reinforces collaborative behaviors.

This document provides a comprehensive guide for backend developers to implement the required endpoints and behaviors to support the Gratitude feature in the LIFT frontend application.
73 changes: 0 additions & 73 deletions MIGRATION_GUIDE.md

This file was deleted.

3 changes: 3 additions & 0 deletions allcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
".DS_Store",
".aider.chat.history.md",
".aider.input.history",
"MAGIC_LINK_AUTH.md",
"CLADE.md",
"GRATITUDE_API.md",
}


Expand Down
Binary file removed docs/IGT DPIA Screening Tool.docx
Binary file not shown.
Loading