feat: Add CORS support and refactor response handling in Lambda funct…#13
Merged
feat: Add CORS support and refactor response handling in Lambda funct…#13
Conversation
…ions - Introduced createCorsResponse and handleOptionsRequest helper functions for consistent CORS responses. - Updated readDeadlines, readUsers, updateDeadlines, updateUser Lambda functions to utilize new CORS helpers. - Modified parameters.json to reflect the latest layer version. - Enhanced AddDeadline and DeadlineDetails pages with mobile sidebar functionality and responsive design improvements. - Implemented date formatting improvements in Dashboard and DeadlineDetails components. - Refined CSS styles for better responsiveness across various screen sizes.
Reviewer's GuideThis PR centralizes CORS logic into shared helpers and refactors all Lambda handlers to use them, updates the shared layer version, and enhances the front-end with responsive layouts, mobile sidebar toggles, custom dropdown styling, and streamlined date formatting. Sequence diagram for centralized CORS handling in Lambda functionssequenceDiagram
participant Client
participant API Gateway
participant Lambda
participant Helper as CORS Helper
Client->>API Gateway: HTTP request (any method)
API Gateway->>Lambda: Invoke Lambda with event
Lambda->>Lambda: Check event.httpMethod
alt OPTIONS request
Lambda->>Helper: handleOptionsRequest()
Helper-->>Lambda: CORS preflight response
Lambda-->>API Gateway: Return CORS preflight response
else Other HTTP methods
Lambda->>Helper: createCorsResponse(status, body)
Helper-->>Lambda: Response with CORS headers
Lambda-->>API Gateway: Return CORS response
end
API Gateway-->>Client: Response with CORS headers
Class diagram for shared CORS helpers and Lambda handler usageclassDiagram
class Helper {
+createCorsResponse(statusCode, body)
+handleOptionsRequest()
+validateDeadline(data)
+getS3AvatarConfig()
+getS3LogoConfig()
}
class LambdaHandler {
+handler(event)
}
Helper <.. LambdaHandler : uses
class createDeadlineHandler {
+handler(event)
}
class updateDeadlinesHandler {
+handler(event)
}
class deleteDeadlinesHandler {
+handler(event)
}
class readDeadlinesHandler {
+handler(event)
}
class createUsersHandler {
+handler(event)
}
class updateUserHandler {
+handler(event)
}
class deleteUserHandler {
+handler(event)
}
class readUsersHandler {
+handler(event)
}
class getAppConfigHandler {
+handler(event)
}
Helper <.. createDeadlineHandler : uses
Helper <.. updateDeadlinesHandler : uses
Helper <.. deleteDeadlinesHandler : uses
Helper <.. readDeadlinesHandler : uses
Helper <.. createUsersHandler : uses
Helper <.. updateUserHandler : uses
Helper <.. deleteUserHandler : uses
Helper <.. readUsersHandler : uses
Helper <.. getAppConfigHandler : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ions
Summary by Sourcery
Enable CORS across all Lambda endpoints with shared helper functions and streamline response handling; introduce mobile sidebar toggles in AddDeadline and DeadlineDetails pages alongside a short date formatter in Dashboard; apply extensive responsive design and truncation improvements in CSS for forms and cards; and bump the shared utils layer version.
New Features:
Enhancements:
Chores: