diff --git a/docs/attendance-service/1_about.md b/docs/attendance-service/1_about.md new file mode 100644 index 0000000..68f0de5 --- /dev/null +++ b/docs/attendance-service/1_about.md @@ -0,0 +1,7 @@ +--- +sidebar_position: 1 +--- + +# About + +The attendance service is used to mark attendance for different context - events and cohorts, with its contextId. It supports latitude and longitude for location based attendance. Scope of the attendance can be self or student. It can be used to mark present, absent or on-leave records. diff --git a/docs/attendance-service/2_features.md b/docs/attendance-service/2_features.md new file mode 100644 index 0000000..4f20f50 --- /dev/null +++ b/docs/attendance-service/2_features.md @@ -0,0 +1,13 @@ +--- +sidebar_position: 2 +--- + +# Features + +Following are the key features + +#### 1. Mark Bulk attendance #### +Mark attendance of multiple users with bulk attendance marking API. + +#### 2. Search Attendance with filters and facets #### +Search with limit and offsets along with various filters and facets. Facets are all column names of the table. Sort on facets or filters as per requirements. \ No newline at end of file diff --git a/docs/attendance-service/3_getting-started.md b/docs/attendance-service/3_getting-started.md new file mode 100644 index 0000000..ed8515f --- /dev/null +++ b/docs/attendance-service/3_getting-started.md @@ -0,0 +1,28 @@ +--- +sidebar_position: 3 +--- + +# Getting Started + +Before setting up the Attendance service, ensure you have the following prerequisites + +### Prerequisites + +- [Node.js] - Version 20 or later +- [NestJS] - Familiarity with NestJS framework +- [PostgreSQL] - Database for storing Attendance data + +[//]: # +[Node.js]: http://nodejs.org +[NestJS]: https://docs.nestjs.com +[PostgreSQL]: https://www.postgresql.org/ + +### Setting Up Locally + +Follow these steps to set up the Attendance service on your local machine: + +1. **Install Node.js** + If you haven’t already installed Node.js, download it from the [Node.js official website](http://nodejs.org). Follow the installation instructions for your operating system. + +2. **Install PostgreSQL** + Download and install PostgreSQL from the [PostgreSQL official website](https://www.postgresql.org/download/). Follow the instructions based on your operating system to complete the installation. During installation, take note of the username and password you create for the database. diff --git a/docs/attendance-service/4_tech-stack.md b/docs/attendance-service/4_tech-stack.md new file mode 100644 index 0000000..f00c670 --- /dev/null +++ b/docs/attendance-service/4_tech-stack.md @@ -0,0 +1,17 @@ +--- +sidebar_position: 4 +--- + +# Tech Stack + +#### Framework : +- **nest.js** (for Node.js) + +#### Language : +- **typescript** + +#### APIs : +- **REST** + +#### Database : +- **PostgreSQL** diff --git a/docs/attendance-service/5_architecture.md b/docs/attendance-service/5_architecture.md new file mode 100644 index 0000000..4c5fbd1 --- /dev/null +++ b/docs/attendance-service/5_architecture.md @@ -0,0 +1,7 @@ +--- +sidebar_position: 5 +--- + +# Architecture + +![Attendance Service Architecture](assets/attendance_architecture.png) diff --git a/docs/attendance-service/6_database-schema.md b/docs/attendance-service/6_database-schema.md new file mode 100644 index 0000000..f079982 --- /dev/null +++ b/docs/attendance-service/6_database-schema.md @@ -0,0 +1,47 @@ +--- +sidebar_position: 6 +--- + +# Database Schema + +## Entities -Attendance Management + +### Table: Attendance + +| **Column Name** | **Data Type** | **Details** | +|---------------------|--------------------------|-------------------------------------------------------------------------------------------------| +| `attendance` | `varchar` | **NOT NULL**, must be one of (`present`, `absent`, `on-leave`) | +| `remark` | `varchar(255)` | Optional | +| `image` | `varchar(500)` | Optional | +| `metaData` | `varchar` | Optional | +| `syncTime` | `varchar` | Optional | +| `session` | `varchar` | Optional | +| `contextId` | `uuid` | **NOT NULL** | +| `context` | `varchar(255)` | **NOT NULL** | +| `createdAt` | `timestamptz` | Defaults to current timestamp | +| `updatedAt` | `timestamptz` | Defaults to current timestamp | +| `attendanceId` | `uuid` | **NOT NULL**, Primary Key, defaults to `gen_random_uuid()` | +| `tenantId` | `uuid` | **NOT NULL** | +| `userId` | `uuid` | **NOT NULL** | +| `attendanceDate` | `date` | **NOT NULL**, defaults to current date | +| `latitude` | `float8` | Optional | +| `longitude` | `float8` | Optional | +| `createdBy` | `uuid` | Optional | +| `updatedBy` | `uuid` | Optional | +| `scope` | `public.attendance_scope` | Optional | + +## Indexes + +- **`Attendance_tenant`**: Hash index on `tenantId`. +- **`Attendance_userId`**: Hash index on `userId`. + +## Constraints + +1. **Primary Key**: `PK_Attendance_attendanceId` on `attendanceId`. +2. **Check Constraint**: `attendance` must be one of `present`, `absent`, or `on-leave`. + +## Triggers + +- **`set_public_Attendance_updatedAt`**: Trigger to update `updatedAt` timestamp before any update operation. + +![NotificationLogs](assets/attendance.png) diff --git a/docs/attendance-service/8_devops.md b/docs/attendance-service/8_devops.md new file mode 100644 index 0000000..4aec8e6 --- /dev/null +++ b/docs/attendance-service/8_devops.md @@ -0,0 +1,42 @@ +--- +sidebar_position: 8 +--- + +# Installation + +## Steps to Install Locally for Development + +### 1. Clone Git Repository + +```sh +git clone https://github.com/tekdi/attendance-microservice +cd attendance-microservice +npm install +``` + +### 2. Setup DB + +Make sure you have PostgreSQL installed and running. Create a database for the attendance service + +### 3. Environment Variables + +Create a .env file in the root directory of your project and add the necessary environment variables. + +```dotenv + +#server +POSTGRES_HOST="add-here" +POSTGRES_PORT="add-here" +POSTGRES_USERNAME="add-here" +POSTGRES_PASSWORD="add-here" +POSTGRES_DATABASE="add-here" +``` + +### 4. Run the Application + +```sh +npm run start:dev +``` + +## Steps for Server Side Setup +@TODO diff --git a/docs/attendance-service/_category_.json b/docs/attendance-service/_category_.json new file mode 100644 index 0000000..852155a --- /dev/null +++ b/docs/attendance-service/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Attendance Service", + "position": 3, + "link": { + "type": "generated-index", + "description": "Learn about Attendance service" + } +} diff --git a/docs/attendance-service/apis/attendance-api-collection.info.mdx b/docs/attendance-service/apis/attendance-api-collection.info.mdx new file mode 100644 index 0000000..91b97e5 --- /dev/null +++ b/docs/attendance-service/apis/attendance-api-collection.info.mdx @@ -0,0 +1,76 @@ +--- +id: attendance-api-collection +title: "Attendance API Collection" +description: "APIs of Attendance Service" +sidebar_label: Introduction +sidebar_position: 0 +hide_title: true +custom_edit_url: null +--- + +import ApiLogo from "@theme/ApiLogo"; +import Heading from "@theme/Heading"; +import SchemaTabs from "@theme/SchemaTabs"; +import TabItem from "@theme/TabItem"; +import Export from "@theme/ApiExplorer/Export"; + + + + + + + + + +APIs of Attendance Service + +
+ + + + + + + +
+ + + + + + + + +
+ Security Scheme Type: + + apiKey +
+ Header parameter name: + + Authorization +
+
+
+
+
+ \ No newline at end of file diff --git a/docs/attendance-service/apis/attendance-controller-create-attendance.api.mdx b/docs/attendance-service/apis/attendance-controller-create-attendance.api.mdx new file mode 100644 index 0000000..a5dca12 --- /dev/null +++ b/docs/attendance-service/apis/attendance-controller-create-attendance.api.mdx @@ -0,0 +1,71 @@ +--- +id: attendance-controller-create-attendance +title: "Create Attendance" +description: "Create Attendance" +sidebar_label: "Create Attendance" +hide_title: true +hide_table_of_contents: true +api: eJyVlktv4zYQgP8KMacuIMWS7diJbmmyh6AoGmzcS4OgGEtjmxuJ1JKUd1XD/70YSdHL3tT1JRE5nOc3Qx5A52TQSa0eE4jgzjlSCaqY7rVyRqcpmb9jQ+io2wIPcjSYkSNjIXo5gMKMIILCknlMwAND3wppKIHImYI8kAoi+FaQKcGDhGxsZM422zOiPeGBjXeUIUQHoB+Y5SlrDqczml8vlj7d3K79cJrMfJxfL/z5dLEI5+FyHgQBeODKnKWtM1Jt4Xj0WtccKVROsv7KmR1hQmZgbXz4tY6DrPtVJyVLjMOKtXKkHG9hnqcyrhI5+Wo5ssOpar3+SrHj9BlOu5NkebdJ24kL41StdiRYViZCb4TbkcB+TRLaYJE6iACOHnRbD+joMuUJOjpVLaQSG20ydKIsy9LPMj9JBvamwXTuh1M/uF2FQTRdRrPF1Xwx+2vox2U+9Oz+d5CGMjRvZ4rnQYpOuiLpW1VFtiZTbWq1/fmuzHB7xtujBxk5fEB3DhcPbKnilczOn7RkrayxONmrMPrhLstPI3xBchrJS8lqxS9QbWOdn4vz2G/9l24ejGAcUNF39NUDJ13V8d24eXCabTbDoOqY+/FE4m4rsgxNCRF8riUZWnEiOQ79gRzKlBJBH5/aY1pUdsaN1aN/GFgEuSFLyomJwHXzj1Z+Srgn6OAF6NMaDOgMWhpZqsOPvzreqq93wOB3bVRd5BYsoH1tPtY7bdwg5xEk8fomWN7M/GAR3vrzm+uNv57i0qd4nmymIS1xEUBbdLCUbsREWPZQOThWPw7H5lrZukDTIOQ/w1R3+RQ7tGJNpER9tyTCFnFM1m6KNC2vKpAcbvly6Z1iPIYa6zqJQaEycjvNYeXaVrMW3Q4imGAuJ/twMiDPktnXd9grf8SFka585rFdh4GVU77Tb9RvXczlb1SeXCXNVXNXuJ028p/qMqhC4QvhS3eVfH6/1rrR3zXmB3iNhusItlZDy1W7cgFdrWyPsXatR1q31vLWLnW4jZeGIbYgtRNQqo2u8nvS/OLu6VHc8zskrtI5JuDu6dHywOqdeCazl3XPkml8DK+CxhuMedByVZiPDKu6NpU7h9PAXEsABzXJU5SK3S9Myns1aS+MBxsPhxV69WDHREYvcDis0dKfJj0eebl+GPE7KpEW1ykPzw2mlk6stw8O+OVLM2c/idMX1Fkn36jsP9GaeQbA75w9GsmGuRGO3jvR/8+jj+323l+dZe/Q7N7XWvwVK+gkTh5V7Gvb309/PK/Ag3XzOMs0Iw0Gv3MP4PfaJV15WjVztXaAFNW2qKGvdfLvX1AGt5A= +sidebar_class_name: "post api-method" +info_path: docs/attendance-service/apis/attendance-api-collection +custom_edit_url: null +--- + +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + + + +Create Attendance + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/attendance-service/apis/attendance-controller-multiple-attendance.api.mdx b/docs/attendance-service/apis/attendance-controller-multiple-attendance.api.mdx new file mode 100644 index 0000000..60b3521 --- /dev/null +++ b/docs/attendance-service/apis/attendance-controller-multiple-attendance.api.mdx @@ -0,0 +1,71 @@ +--- +id: attendance-controller-multiple-attendance +title: "Create Bulk Attendance" +description: "Create Bulk Attendance" +sidebar_label: "Create Bulk Attendance"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s72abNvr0qzy5X8225EGx5vxYdun34+7faJXmk56PfJ+OOAl1MHnD68R34rNGC7/fr/Ec6p3OY2xc246yF5dX8nbvhFFtmMjsG4ur/TvJV6Nx5J7WU9lUg1xvxPp1mCEe97LgwTk6ItbVO8X1I2sNmSwNWYFQnKzC56lfBZDeAzY8IejGaJAyMMXxzYMbnhMxwOG9T0VSXHI3+un41cwVhq3CS8SbaYaDpzp32OwW8PzdL5XZy/Lye9fqOq/4Bt5jgAvwL3qCQb5g45OifU/5tH79vtvU47y86hOb2ptbhPrKCTOHtysq/tHLj/8vjEaW6ermnOxILCH4w4/qhdyq2ntsvttwMkmL2WNdO1Tv79A8u8JZs= +sidebar_class_name: "post api-method" +info_path: docs/attendance-service/apis/attendance-api-collection +custom_edit_url: null +--- + +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + + + +Create Bulk Attendance + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/attendance-service/apis/attendance-controller-search-attendance-new.api.mdx b/docs/attendance-service/apis/attendance-controller-search-attendance-new.api.mdx new file mode 100644 index 0000000..c524b68 --- /dev/null +++ b/docs/attendance-service/apis/attendance-controller-search-attendance-new.api.mdx @@ -0,0 +1,71 @@ +--- +id: attendance-controller-search-attendance-new +title: "Attendance Search" +description: "Attendance Search" +sidebar_label: "Attendance Search" +hide_title: true +hide_table_of_contents: true +api: eJytVmFv2zYQ/SvCfZZiyXXgRN/SJAOCFWtQe19mGMVJOsdsJVIlKa+aof9eHCXLsqW1GDAjCGDemXd8790jj6BK0miFki8ZxPBgLckMZUqPSlqt8pz0Z0Oo0/059Af9DT6UqLEgS9pAvDmCxIIgBksSpRUZ+CAkxLAnzEiDDybdU4EQH8HWJWcaq4V8g6bZ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9eScp06xbu1I+Qo3yo3ENDuyZ8fABeAeA== +sidebar_class_name: "post api-method" +info_path: docs/attendance-service/apis/attendance-api-collection +custom_edit_url: null +--- + +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; + + + + + + + + + + +Attendance Search + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/attendance-service/assets/attendance.png b/docs/attendance-service/assets/attendance.png new file mode 100644 index 0000000..6e42c4d Binary files /dev/null and b/docs/attendance-service/assets/attendance.png differ diff --git a/docs/attendance-service/assets/attendance_architecture.png b/docs/attendance-service/assets/attendance_architecture.png new file mode 100644 index 0000000..c9abdab Binary files /dev/null and b/docs/attendance-service/assets/attendance_architecture.png differ diff --git a/docs/middleware-service/_category_.json b/docs/middleware-service/_category_.json index bd1675e..547aeb6 100644 --- a/docs/middleware-service/_category_.json +++ b/docs/middleware-service/_category_.json @@ -1,6 +1,6 @@ { "label": "Middleware Service", - "position": 2, + "position": 6, "link": { "type": "generated-index", "description": "Learn about middleware service" diff --git a/docs/notifications-service/_category_.json b/docs/notifications-service/_category_.json index 983eac8..7aabdd4 100644 --- a/docs/notifications-service/_category_.json +++ b/docs/notifications-service/_category_.json @@ -1,6 +1,6 @@ { "label": "Notifications Service", - "position": 3, + "position": 4, "link": { "type": "generated-index", "description": "Learn about notifications service" diff --git a/docs/tekdi-style-guides/_category_.json b/docs/tekdi-style-guides/_category_.json index 0cf5bc0..3e67cdd 100644 --- a/docs/tekdi-style-guides/_category_.json +++ b/docs/tekdi-style-guides/_category_.json @@ -1,6 +1,6 @@ { "label": "Tekdi Style Guides", - "position": 4, + "position": 8, "link": { "type": "generated-index", "description": "Learn about lanauge specific styleguides being used at Tekdi." diff --git a/docs/todo-service/_category_.json b/docs/todo-service/_category_.json index 65c447b..b009924 100644 --- a/docs/todo-service/_category_.json +++ b/docs/todo-service/_category_.json @@ -1,6 +1,6 @@ { "label": "Todo Service", - "position": 1, + "position": 5, "link": { "type": "generated-index", "description": "Learn about Todo service" diff --git a/docs/tools/_category_.json b/docs/tools/_category_.json index 3d4b18e..e007072 100644 --- a/docs/tools/_category_.json +++ b/docs/tools/_category_.json @@ -1,6 +1,6 @@ { "label": "Tools", - "position": 5, + "position": 7, "link": { "type": "generated-index", "description": "Know more about recommended tools" diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 968a8a7..6e185cd 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -79,6 +79,10 @@ const config: Config = { specPath: "swagger/event-service.json", outputDir: "docs/event-service/apis", } satisfies OpenApiPlugin.Options, + attendance: { + specPath: "swagger/attendance-service.json", + outputDir: "docs/attendance-service/apis", + } }, }, ], diff --git a/swagger/attendance-service.json b/swagger/attendance-service.json new file mode 100644 index 0000000..4eabbd1 --- /dev/null +++ b/swagger/attendance-service.json @@ -0,0 +1,403 @@ +{ + "openapi": "3.0.0", + "paths": { + "/api/v1/attendance": { + "post": { + "operationId": "AttendanceController_createAttendance", + "summary": "Create Attendance", + "parameters": [ + { + "name": "userId", + "required": true, + "in": "query", + "description": "userId required", + "schema": { + "example": "123e4567-e89b-12d3-a456-426614174000", + "type": "string" + } + }, + { + "name": "tenantid", + "in": "header", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AttendanceDto" + }, + "examples": { + "CreateAttendance": { + "summary": "Example for CreateAttendance", + "description": "Detailed example for CreateAttendance", + "value": { + "attendanceDate": "2024-12-09", + "attendance": "present / absent / on-leave", + "remark": "", + "latitude": 0, + "longitude": 0, + "image": "", + "metaData": "", + "syncTime": "", + "session": "Morning", + "context": "event / cohort", + "contextId": "dcb80783-0619-485f-b2a7-ec4df21e7a60", + "scope": "self / student" + } + } + } + } + } + }, + "responses": { + "201": { + "description": "Attendance has been created successfully." + } + }, + "tags": ["Attendance"] + } + }, + "/api/v1/attendance/list": { + "post": { + "operationId": "AttendanceController_searchAttendanceNew", + "summary": "Attendance Search", + "parameters": [ + { + "name": "tenantid", + "in": "header", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AttendanceSearchDto" + }, + "examples": { + "SearchAttendance": { + "summary": "Example for SearchAttendance", + "description": "Detailed example for SearchAttendance", + "value": { + "limit": 0, + "page": 0, + "filters": { + "contextId": "2b73b482-d8bf-41a2-bd49-91a7a4abd7d4", + "fromDate": "2024-11-07T00:00:00.000Z", + "toDate": "2024-11-13T00:00:00.000Z", + "scope": "student", + "context": "cohort" + }, + "facets": ["contextId"], + "sort": ["absent_percentage", "asc"] + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Attendance List" + }, + "400": { + "description": "Bad Request" + }, + "500": { + "description": "Internal Server Error" + } + }, + "tags": ["Attendance"] + } + }, + "/api/v1/attendance/bulkAttendance": { + "post": { + "operationId": "AttendanceController_multipleAttendance", + "summary": "Create Bulk Attendance", + "parameters": [ + { + "name": "userId", + "required": true, + "in": "query", + "description": "userId required", + "schema": { + "example": "123e4567-e89b-12d3-a456-426614174000", + "type": "string" + } + }, + { + "name": "tenantid", + "in": "header", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BulkAttendanceDTO" + }, + "examples": { + "CreateBulkAttendance": { + "summary": "Example for CreateBulkAttendance", + "description": "Detailed example for CreateBulkAttendance", + "value": { + "attendanceDate": "2024-12-09", + "contextId": "dcb80783-0619-485f-b2a7-ec4df21e7a60", + "context": "cohort / event", + "scope": "self / student", + "userAttendance": [ + { + "userId": "2447aa0c-4111-4cb9-94d1-9898ef6975a1", + "attendance": "", + "remark": "string", + "latitude": 0, + "longitude": 0, + "image": "string", + "metaData": "string", + "syncTime": "string", + "session": "string" + } + ] + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Attendance updated successfully" + }, + "201": { + "description": "Attendance has been created successfully." + }, + "400": { + "description": "Bad Request" + }, + "500": { + "description": "Internal server error" + } + }, + "tags": ["Attendance"] + } + } + }, + "info": { + "title": "Attendance API Collection", + "description": "APIs of Attendance Service", + "version": "1.0", + "contact": {} + }, + "tags": [], + "servers": [], + "components": { + "securitySchemes": { + "access-token": { + "type": "apiKey", + "in": "header", + "name": "Authorization" + } + }, + "schemas": { + "AttendanceDto": { + "type": "object", + "properties": { + "userId": { + "type": "string", + "description": "The userid of the attendance", + "default": "" + }, + "attendanceDate": { + "type": "string", + "description": "The date of the attendance in format yyyy-mm-dd", + "default": "2024-12-09T10:27:36.463Z" + }, + "attendance": { + "type": "string", + "description": "The attendance of the attendance", + "default": "" + }, + "remark": { + "type": "string" + }, + "latitude": { + "type": "number" + }, + "longitude": { + "type": "number" + }, + "image": { + "type": "string" + }, + "metaData": { + "type": "string" + }, + "syncTime": { + "type": "string" + }, + "session": { + "type": "string" + }, + "context": { + "type": "string", + "description": "The context of the attendance", + "default": "" + }, + "contextId": { + "type": "string", + "description": "The contextId of the attendance", + "default": "" + }, + "scope": { + "type": "string" + } + }, + "required": ["userId", "attendanceDate", "attendance", "contextId"] + }, + "AttendanceFiltersDto": { + "type": "object", + "properties": { + "fromDate": { + "format": "date-time", + "type": "string", + "default": "yyyy-mm-dd" + }, + "toDate": { + "format": "date-time", + "type": "string", + "default": "yyyy-mm-dd" + }, + "contextId": { + "type": "string" + }, + "context": { + "type": "string" + }, + "scope": { + "type": "string" + }, + "attendanceDate": { + "type": "string", + "description": "The date of the attendance in format yyyy-mm-dd", + "default": "yyyy-mm-dd" + }, + "userId": { + "type": "string" + } + } + }, + "AttendanceSearchDto": { + "type": "object", + "properties": { + "limit": { + "type": "number", + "description": "Limit" + }, + "page": { + "type": "number", + "description": "number" + }, + "filters": { + "description": "Filters", + "allOf": [ + { + "$ref": "#/components/schemas/AttendanceFiltersDto" + } + ] + }, + "facets": { + "description": "Facets", + "example": ["contextId", "userId", "scope"], + "type": "array", + "items": { + "type": "string" + } + }, + "sort": { + "description": "Sort", + "example": ["attendanceDate", "asc"], + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["page"] + }, + "UserAttendanceDTO": { + "type": "object", + "properties": { + "userId": { + "type": "string" + }, + "attendance": { + "type": "string", + "description": "The attendance of the attendance", + "default": "" + }, + "remark": { + "type": "string" + }, + "latitude": { + "type": "number" + }, + "longitude": { + "type": "number" + }, + "image": { + "type": "string" + }, + "metaData": { + "type": "string" + }, + "syncTime": { + "type": "string" + }, + "session": { + "type": "string" + } + }, + "required": ["userId", "attendance"] + }, + "BulkAttendanceDTO": { + "type": "object", + "properties": { + "attendanceDate": { + "type": "string", + "description": "The date of the attendance in format yyyy-mm-dd" + }, + "contextId": { + "type": "string" + }, + "context": { + "type": "string", + "description": "The context of the attendance" + }, + "scope": { + "type": "string" + }, + "userAttendance": { + "description": "List of user attendance details", + "type": "array", + "items": { + "$ref": "#/components/schemas/UserAttendanceDTO" + } + } + }, + "required": ["attendanceDate", "contextId", "context", "userAttendance"] + } + } + } +}