| Name | Version |
|---|---|
| archive | ~> 2.0 |
| aws | ~> 5.0 |
| Name | Version |
|---|---|
| archive | 2.4.2 |
| aws | 5.37.0 |
No modules.
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| account_id | AWS account ID | string |
"590183910477" |
no |
| attendance_frontend_logs | n/a | string |
"attendance-frontend-logs" |
no |
| lambda_functions | Defining the lambda functions and their handlers. | map(string) |
{ |
no |
| region | AWS region | string |
"eu-central-1" |
no |
| s3_name_frontend | name for S3 bucket front-end | string |
"attendance-frontend-bucket" |
no |
| s3_origin_id | Defining the s3 origin id for the CloudFront distribution. | string |
"s3CodeBucketOrigin" |
no |
| student_pool_name | Name of the student_pool_id. | string |
"student-attendance-system" |
no |
| to_define_methods | Defining the methods that have to be created for the API Gateway. | list(string) |
[ |
no |
| to_define_paths | Defining the paths that have to be created for the API Gateway. | list(string) |
[ |
no |
No outputs.
Contents:
Create object for an admin record.
- Parameters:
- item_id (str) – The ID of the admin record.
- user_name (str) – The name of the admin.
- Returns: The response from the table.put_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while putting the item.
Delete an admin record.
- Parameters: item_id (str) – The ID of the admin record.
- Returns: The response from the table.delete_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while deleting the item.
Get an admin record.
- Parameters: item_id (str) – The ID of the admin record.
- Returns: The response from the table.get_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while getting the item.
Lambda handler for the admin. The ‘operation’ field in the event data determines the action to be performed. The following operations are supported:
- ‘put’: Creates a new record for an admin.
- ‘update’: Updates an admin record.
- ‘delete’: Deletes an admin record.
- ‘get’: Retrieves an admin record.
The corresponding functions called for each operation are:
- ‘put’: create_admin_record()
- ‘update’: update_admin_record()
- ‘delete’: delete_admin_record()
- ‘get’: get_admin_record()
- Parameters:
- event (dict) – The event object.
- context (object) – The context object.
- Returns: The response object.
- Return type: dict
Create a response object for the API Gateway.
- Parameters:
- status_code (int) – The status code for the response.
- body (str) – The body of the response.
- Returns: The response object.
- Return type: dict
Update an admin record.
- Parameters:
- item_id (str) – The ID of the admin record.
- user_name (str) – The name of the admin.
- Returns: The response from the table.update_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while updating the item.
Create object for a teacher.
- Parameters:
- user_id (str) – The ID of the user.
- user_name (str) – The name of the user.
- Returns: The response from the table.put_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while putting the item.
Create object for a teacher.
- Parameters:
- email (str) – The email of the user.
- user_name (str) – The name of the user.
- Returns: The response from the table.put_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while putting the item.
Create object for a teacher.
- Parameters:
- user_id (str) – The ID of the user.
- user_name (str) – The name of the user.
- Returns: The response from the table.put_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while putting the item.
Create a response object for the API Gateway.
- Parameters:
- status_code (int) – The status code for the response.
- body (str) – The body of the response.
- Returns: The response object.
- Return type: dict
Create object for a course.
- Parameters:
- item_id (str) – The ID of the course.
- course_name (str) – The name of the course.
- department_id (str) – The ID of the department.
- classes (dict) – The classes for the course.
- Returns: The response from the table.put_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while putting the item.
Delete a course.
- Parameters: item_id (str) – The ID of the course.
- Returns: The response from the table.delete_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while deleting the item.
Get a course.
- Parameters: item_id (str) – The ID of the course.
- Returns: The course object.
- Return type: dict
- Raises: ClientError – If an error occurs while getting the item.
Lambda handler function to interact with the DynamoDB table. The function will perform the operation specified in the ‘func’ query parameter. The following operations are supported:
- create_course: Create a course.
- get_course: Get a course.
- update_course: Update a course.
- delete_course: Delete a course.
- Parameters:
- event (dict) – The event object from the Lambda function.
- context (object) – The context object from the Lambda function.
- Returns: The response object for the API Gateway.
- Return type: dict
Create a response object for the API Gateway.
- Parameters:
- status_code (int) – The status code for the response.
- body (str) – The body of the response.
- Returns: The response object.
- Return type: dict
Update object for a course.
- Parameters:
- item_id (str) – The ID of the course.
- course_name (str) – The name of the course.
- department_id (str) – The ID of the department.
- classes (dict) – The classes for the course.
- Returns: The response from the table.update_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while updating the item.
Create object for a department.
- Parameters:
- dep_id (str) – The ID of the department.
- dep_name (str) – The name of the department.
- Returns: The response from the table.put_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while putting the item.
Delete a department.
- Parameters: dep_id (str) – The ID of the department.
- Returns: The response from the table.delete_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while deleting the item.
Get a department.
- Parameters: dep_id (str) – The ID of the department.
- Returns: The department object.
- Return type: dict
- Raises: ClientError – If an error occurs while getting the item.
Get the course names for a department.
- Parameters: dep_id (str) – The ID of the department.
- Returns: The list of course names for the department. : [{‘CourseName’: ‘Mathematics’, ‘ItemId’: 101}, {‘CourseName’: ‘Physics’, ‘ItemId’: 102}]
- Return type: list
- Raises: ClientError – If an error occurs while querying the items.
Get the courses for a department.
- Parameters: dep_id (str) – The ID of the department.
- Returns: The list of courses for the department.
- Return type: list
- Raises: ClientError – If an error occurs while querying the items.
Lambda handler for the department. The ‘operation’ field in the event data determines the action to be performed. The following operations are supported:
- ‘put’: Creates a new record for a department.
- ‘get’: Retrieves a department.
- ‘update’: Updates a record for a department.
- ‘delete’: Deletes a record for a department.
The corresponding functions called for each operation are:
- ‘put’: create_department()
- ‘get’: get_department()
- ‘update’: update_department()
- ‘delete’: delete_department()
- Parameters:
- event (dict) – The event object.
- context (object) – The context object.
- Returns: The response object.
- Return type: dict
- Raises: ValueError – If the operation is not supported.
Create a response object for the API Gateway.
- Parameters:
- status_code (int) – The status code for the response.
- body (str) – The body of the response.
- Returns: The response object.
- Return type: dict
Update object for a department.
- Parameters:
- dep_id (str) – The ID of the department.
- dep_name (str) – The name of the department.
- Returns: The response from the table.put_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while putting the item.
This module contains functions for managing attendance records for students in a DynamoDB table.
Functions:
- create_student_record: Create a student record in the database.
- remove_student_course_attendance: Removes the attendance record of a student for a specific course.
- delete_student_record: Deletes a student record from the table.
- update_student_record: Update the student record in the database.
- update_attendance_record: Update the attendance record for a student.
- get_student: Gets the student record.
- get_student_courses: Retrieves all the courses of a student.
- get_student_course_attendance: Retrieves the attendance record of a student for a specific course.
- lambda_handler: Lambda handler function to interact with the DynamoDB table.
Create a student record in the database.
- Parameters:
- user_id (str) – The ID of the student.
- course_id ( #) – The ID of the course.
- course_name ( #) – The name of the course.
- user_name (str) – The name of the student.
- Returns: The response from the database after creating the student record. : If an error occurs, None is returned.
- Return type: dict
Deletes a record from the table using its ItemId.
- Parameters: ItemId (str) – The ID of the item.
- Returns: The response from the delete operation, or None if an error occurred.
- Return type: dict or None
Enlist a student to a course.
- Parameters:
- user_id (str) – The ID of the student.
- course_id (str) – The ID of the course.
- Returns: The response from the put operation, or None if an error occurred.
- Return type: dict or None
Retrieves all the courses from the database. Placed in student.py because of the large frequency in which this function is called.
- Returns: A list of items containing all the courses.
- Return type: list
Retrieves all the attendance records for all courses of a student.
- Parameters: user_id (str) – The user ID of the student.
- Returns: A list of items containing the student’s information.
- Return type: list
- Raises: ClientError – If an error occurs while querying the table.
Retrieves the attendance record of a student for a specific course.
- Parameters:
- user_id (str) – The ID of the student.
- course_id (str) – The ID of the course.
- Returns: The attendance record of the student for the course, or None if an error occurs.
- Return type: dict
Retrieves the names of all the courses of a student.
- Parameters: user_id (str) – The user ID of the student.
- Returns: A dictionary containing the course names of the student. : {course_id: course_name}
- Return type: dict
- Raises: ClientError – If an error occurs while querying the table.
Retrieves all the courses of a student.
- Parameters: user_id (str) – The user ID of the student.
- Returns: A list of items containing the student’s information.
- Return type: list
- Raises: ClientError – If an error occurs while querying the table.
Lambda handler function to interact with the DynamoDB table. The ‘operation’ field in the body data determines the action to be performed. The following operations are supported:
- ‘put’: Creates a new record for a student.
- ‘update’: Updates a student record or attendance record.
- ‘get’: Retrieves all courses for a student or all attendance records for a student’s course.
- ‘delete’: Deletes a record for a student.
The corresponding functions called for each operation are:
- ‘put’: create_student_record() or enlist_student_course()
- ‘update’: update_attendance_record() or update_student_record()
- ‘get’: get_student_course_attendance() or get_student() or get_student_courses()
- ‘delete’: delete_student_record() or remove_student_course_attendance()
- Parameters:
- body (dict) – The body data passed to the Lambda function.
- context (object) – The context object provided by AWS Lambda.
- Returns: The response containing the statusCode, body, and headers.
- Return type: dict
Create a response object for the API Gateway.
- Parameters:
- status_code (int) – The status code for the response.
- body (str) – The body of the response.
- Returns: The response object.
- Return type: dict
Removes the attendance record of a student for a specific course.
- Parameters:
- user_id (str) – The ID of the student.
- course_id (str) – The ID of the course.
- Returns: The response from the delete operation, or None if an error occurred.
- Return type: dict or None
Update the attendance record for a student in a specific course. Updates one attendance instance (date) at a time
- Parameters:
-
item_id (str) – The ID of the item. In this case the item is the student’s attendance record for the course.
-
attendance (dict) –
The updated attendance value. This is a nested object with the following structure:
attendance = { : ‘date’: { : ‘from’: (str), ‘to’: (str), ‘status’: (str)
}
-
- Returns: The response from the update operation if successful, None otherwise.
- Return type: dict or None
Update the student record in the database.
- Parameters:
- user_id (str) – The ID of the student.
- user_name (str) – The name of the student.
- Returns: The response from the update operation if successful, None otherwise.
- Return type: dict or None
This module contains functions for managing attendance records for teachers in a DynamoDB table.
Functions:
- put_attendance_record: Put attendance record for a teacher.
- get_all_courses: Get all courses for a teacher.
- get_all_course_attendance: Get all attendance records of students for a teacher’s course.
- delete_attendance_record: Delete attendance record for a teacher.
- lambda_handler: Lambda handler function to interact with the DynamoDB table.
Assign a course to a teacher.
- Parameters:
- course_id (str) – The ID of the course.
- user_id (str) – The ID of the user.
- Returns: The response from the table.put_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while putting the item.
Create object for a teacher.
- Parameters:
- user_id (str) – The ID of the user.
- user_name (str) – The name of the user.
- Returns: The response from the table.put_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while putting the item.
Delete teacher’s record.
- Parameters: user_id (str) – The ID of the user.
- Returns: The response from the table.delete_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while deleting the item.
Get all attendance records of students for a teacher’s course. If the attendance record for a class in the course is not found for a student, the class is added to the list with no status value and key. Uses the Global Secondary Index CourseIDUserTypeIndex to query the table.
- Parameters: course_id (str) – The ID of the course.
- Returns: The list of attendance records for the teacher’s course.
- Return type: list
- Raises: ClientError – If an error occurs while getting the items.
Get a teacher.
- Parameters: user_id (str) – The ID of the user.
- Returns: The teacher object.
- Return type: dict
- Raises: ClientError – If an error occurs while getting the item.
Get all course names for a teacher.
- Parameters: user_id (str) – The ID of the user.
- Returns: The list of course names for the teacher.
- Return type: list
- Raises: ClientError – If an error occurs while getting the items.
Get all courses for a teacher.
- Parameters: user_id (str) – The ID of the user.
- Returns: The list of courses for the teacher.
- Return type: list
- Raises: ClientError – If an error occurs while getting the items.
Lambda handler function to interact with the DynamoDB table. The ‘operation’ field in the event data determines the action to be performed. The following operations are supported:
- ‘put’: Creates a new record for a teacher.
- ‘get’: Retrieves all courses for a teacher or all attendance records for a teacher’s course.
- ‘update’: Updates a teacher’s record.
- ‘delete’: Deletes a teacher’s record.
The corresponding functions called for each operation are:
- ‘put’: create_teacher_record()
- ‘get’: get_teacher_courses() or get_all_course_attendance()
- ‘update’: update_teacher_record()
- ‘delete’: delete_teacher()
- Parameters:
- event (dict) – The event data passed to the Lambda function.
- context (object) – The context object provided by AWS Lambda.
- Returns: The response containing the statusCode, body, and headers.
- Return type: dict
Create a response object for the API Gateway.
- Parameters:
- status_code (int) – The status code for the response.
- body (str) – The body of the response.
- Returns: The response object.
- Return type: dict
Update object for a teacher.
- Parameters:
- item_id (str) – The ID of the user.
- user_name (str) – The name of the user.
- Returns: The response from the table.update_item() operation.
- Return type: dict
- Raises: ClientError – If an error occurs while updating the item.
attendance-app / Modules
▸ assign_course_to_teacher(ItemId, CourseId, UserId): () => Promise<Response>
Assigns a course to a teacher.
| Name | Type | Description |
|---|---|---|
ItemId |
string |
The ID of the item. |
CourseId |
string |
The ID of the course. |
UserId |
string |
The ID of the user. |
fn
A Promise that resolves to the result of the API call.
▸ (): Promise<Response>
Promise<Response>
▸ get_all_course_attendance(CourseId): () => Promise<Response>
Retrieves the attendance data for a specific course.
| Name | Type | Description |
|---|---|---|
CourseId |
string |
The ID of the course to retrieve attendance data for. |
fn
A Promise that resolves to the attendance data for the specified course.
▸ (): Promise<Response>
Promise<Response>
▸ get_teacher_course_names(ItemId): () => Promise<Response>
Retrieves the course names associated with a teacher.
| Name | Type | Description |
|---|---|---|
ItemId |
string |
The ID of the teacher. |
fn
A Promise that resolves to the course names.
▸ (): Promise<Response>
Promise<Response>
teacher.ts:38 attendance-app / Modules / course
▸ create_course(ItemId, CourseName, DepartmentId): () => Promise<Response>
Creates a new course.
| Name | Type | Description |
|---|---|---|
ItemId |
string |
The ID of the course item. |
CourseName |
string |
The name of the course. |
DepartmentId |
string |
The ID of the department the course belongs to. |
fn
A promise that resolves to the result of the API call.
▸ (): Promise<Response>
Promise<Response>
▸ get_course(ItemId): () => Promise<Response>
Retrieves a course based on the provided ItemId.
| Name | Type | Description |
|---|---|---|
ItemId |
string |
The unique identifier of the course. |
fn
A Promise that resolves to the course data.
▸ (): Promise<Response>
Promise<Response>
▸ update_course(ItemId, CourseName, DepartmentId, Classes): () => Promise<Response>
Updates a course with the specified details.
| Name | Type | Description |
|---|---|---|
ItemId |
string |
The ID of the course to update. |
CourseName |
string |
The new name of the course. |
DepartmentId |
string |
The ID of the department the course belongs to. |
Classes |
Object |
An object containing the classes associated with the course. |
fn
A Promise that resolves to the updated course.
▸ (): Promise<Response>
Promise<Response>
course.ts:77 attendance-app / Modules / student
- create_student
- enlist_student_course
- get_all_courses
- get_student_course_attendance
- get_student_course_names
- get_student_courses
- get_student_list
- update_attendance
▸ create_student(ItemId, UserName, ItemType): () => Promise<Response>
Creates a new student.
| Name | Type | Description |
|---|---|---|
ItemId |
string |
The ID of the student item. |
UserName |
string |
The username of the student. |
ItemType |
string |
The type of the student item. |
fn
A function that performs a fetch request to create a new student.
▸ (): Promise<Response>
Promise<Response>
▸ enlist_student_course(ItemId, UserId, CourseId): () => Promise<Response>
Enlists a student in a course.
| Name | Type | Description |
|---|---|---|
ItemId |
string |
The ID of the item. |
UserId |
string |
The ID of the user. |
CourseId |
string |
The ID of the course. |
fn
A function that performs a fetch request to enlist a student in a course.
▸ (): Promise<Response>
Promise<Response>
▸ get_all_courses(): () => Promise<Response>
Retrieves all courses.
fn
A function that performs a fetch request to get all courses.
▸ (): Promise<Response>
Promise<Response>
▸ get_student_course_attendance(UserId, CourseId): () => Promise<Response>
Retrieves the attendance of a student in a specific course.
| Name | Type | Description |
|---|---|---|
UserId |
string |
The ID of the user. |
CourseId |
string |
The ID of the course. |
fn
A function that performs a fetch request to get the student's course attendance.
▸ (): Promise<Response>
Promise<Response>
▸ get_student_course_names(ItemId): () => Promise<Response>
Retrieves the course names of a specific student.
| Name | Type | Description |
|---|---|---|
ItemId |
string |
The ID of the student. |
fn
A function that performs a fetch request to get the student's course names.
▸ (): Promise<Response>
Promise<Response>
▸ get_student_courses(ItemId): () => Promise<Response>
Retrieves the courses of a specific student.
| Name | Type | Description |
|---|---|---|
ItemId |
string |
The ID of the student. |
fn
A function that performs a fetch request to get the student's courses.
▸ (): Promise<Response>
Promise<Response>
▸ get_student_list(ItemId): () => Promise<Response>
Retrieves the list of students for a specific item.
| Name | Type | Description |
|---|---|---|
ItemId |
string |
The ID of the item. |
fn
A function that performs a fetch request to get the student list.
▸ (): Promise<Response>
Promise<Response>
▸ update_attendance(ItemId, Attendance, courseId): () => Promise<Response>
Updates the attendance of a student for a specific course.
| Name | Type | Description |
|---|---|---|
ItemId |
string |
The ID of the item. |
Attendance |
AttendanceDateRecord |
The attendance record. |
courseId |
string |
The ID of the course. |
fn
A function that performs a fetch request to update the student's attendance.
▸ (): Promise<Response>
Promise<Response>
student.ts:179 attendance-app / Modules / admin
attendance-app / Modules / cognito
▸ create_teacher(username, email): () => Promise<Response>
Creates a teacher record in the system.
| Name | Type | Description |
|---|---|---|
username |
string |
The username of the teacher. |
email |
string |
The email of the teacher. |
fn
A Promise that resolves to the result of the API call.
▸ (): Promise<Response>
Promise<Response>
cognito.ts:39 attendance-app / Modules
This project was bootstrapped with Create React App.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
Note: this is a one-way operation. Once you eject, you can’t go back!
If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.