https://github.com/rafath0ssain/worksync-server
A full-stack employee management app with React.js, Node.js, and MongoDB. Log hours, manage payroll, and oversee roles—streamlined for Employees, HR, and Admins.
https://github.com/rafath0ssain/worksync-server
backend expressjs firebase fullstack hrms jwt mongodb nodejs payroll restapi rolebasedauthrorization
Last synced: 12 days ago
JSON representation
A full-stack employee management app with React.js, Node.js, and MongoDB. Log hours, manage payroll, and oversee roles—streamlined for Employees, HR, and Admins.
- Host: GitHub
- URL: https://github.com/rafath0ssain/worksync-server
- Owner: RafatH0ssain
- Created: 2025-01-15T01:38:15.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-02-26T01:17:53.000Z (11 months ago)
- Last Synced: 2025-02-26T02:24:49.672Z (11 months ago)
- Topics: backend, expressjs, firebase, fullstack, hrms, jwt, mongodb, nodejs, payroll, restapi, rolebasedauthrorization
- Language: JavaScript
- Homepage: https://worksync-2ca3b.web.app
- Size: 8.9 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WorkSync Backend
## Overview
WorkSync's backend is built using **Node.js**, **Express.js**, and **MongoDB**, providing a robust and scalable server for managing employee data, payroll, and user authentication. The API supports role-based access with **JWT authentication** and integrates **Firebase** for secure user management.
## Frontend:
[Github Link](https://github.com/RafatH0ssain/WorkSync-Client)
## 📚 API Documentation
### 👥 User Management
#### 🔍 Get User by UID
**Endpoint:** `GET /users/:uid`
**Description:** Retrieve details of a specific user by their Firebase UID
**Response:**
```json
{
"_id": "string",
"name": "string",
"email": "string",
"userType": "admin|hr|employee",
"status": "active|fired",
"createdAt": "ISO date"
}
```
#### 📋 Get All Users
**Endpoint:** `GET /users`
**Description:** Get all non-admin users
**Response:** Array of user objects
#### 📝 Register User
**Endpoint:** `POST /users`
**Body:**
```json
{
"name": "string",
"email": "string",
"photoURL": "string",
"uid": "string",
"userType": "admin|hr|employee"
}
```
#### ⬆️ Promote to HR
**Endpoint:** `POST /make-hr/:id`
**Description:** Promote an employee to HR role
**Params:** MongoDB document ID
### ❓ Queries
#### ✉️ Submit Query
**Endpoint:** `POST /submit-query`
**Body:**
```json
{
"heading": "string",
"designation": "string",
"details": "string",
"email": "string"
}
```
#### 📨 Get Queries
**Endpoint:** `GET /queries`
**Query Params:** ?email=user@example.com
**Response:** Array of query objects
### 📅 Worksheet Management
#### ➕ Create Worksheet Entry
**Endpoint:** `POST /worksheet`
**Body:**
```json
{
"email": "string",
"hoursWorked": "number",
"date": "ISO date"
}
```
#### 📂 Get Worksheet Entries
**Endpoint:** `GET /worksheet/:email`
**Response:** Array of worksheet entries for specified user
### 💰 Payments
#### 💸 Process Payment
**Endpoint:** `POST /process-payment`
**Body:**
```json
{
"email": "string",
"amount": "number",
"paidBy": "string",
"entries": ["array of entry IDs"]
}
```
#### 📊 Get Payment History
**Endpoint:** `GET /payment-history/:email`
**Response:**
```json
{
"payments": [
{
"month": "string",
"salary": "number",
"approvedBy": "string"
}
]
}
```
#### ⏳ Check Pending Payments
**Endpoint:** `GET /check-pending-payment/:email`
**Response:**
```json
{
"hasPendingPayment": "boolean",
"pendingPayment": "object|null"
}
```
### 💼 Salary Management
#### 📈 Adjust Salary
**Endpoint:** `POST /adjust-salary/:id`
**Params:** MongoDB document ID
**Body:**
```json
{ "salary": "number" }
```
### 📜 Get Salary History
**Endpoint:** `GET /salary-history/:id`
**Response:** Array of salary adjustment objects
## 📬 Contact
For any questions or support, please contact:
📧 [Email](mailto:rafat.click.hossain@gmail.com)
👔 [LinkedIn](https://www.linkedin.com/in/muhammad-rafat-hossain/)
**Let's connect! 🤝**