Skip to content

Commit 95c7c03

Browse files
committed
2 parents aaa5c90 + 9b4b7b5 commit 95c7c03

File tree

1 file changed

+146
-0
lines changed

1 file changed

+146
-0
lines changed

README.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Azure Functions REST API for Business KPIs ✨
2+
3+
## Overview 🌟
4+
This repository contains an Azure Functions REST API designed to interact with a SQL database. The API serves as a data provider for a dashboard, enabling users to manipulate and visualize various business KPIs. Additionally, the system supports the creation of VR visualizations from these KPIs.
5+
6+
## Features 📂
7+
- **SQL Database Integration**: Securely fetch, update, and delete KPI data.
8+
- **RESTful Endpoints**: A set of endpoints for managing and retrieving business KPIs.
9+
- **Dashboard Support**: Provides data endpoints tailored for dashboard visualizations.
10+
- **VR Visualizations**: Exposes data in formats suitable for VR visualization tools.
11+
12+
## Getting Started 🚀💻✨
13+
14+
### Prerequisites 🛠️📋🔑
15+
1. **Azure Account**: Ensure you have an active Azure subscription.
16+
2. **SQL Database**: A pre-configured SQL database with necessary tables and data.
17+
3. **Tools**:
18+
- [Azure Functions Core Tools](https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local) for local development.
19+
- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) for deployment.
20+
- [.NET SDK](https://dotnet.microsoft.com/download) for Azure Functions development.
21+
22+
### Setup ⚙️📦🛠️
23+
1. Clone the repository:
24+
```bash
25+
git clone https://github.com/yourusername/azure-functions-kpi-api.git
26+
cd azure-functions-kpi-api
27+
```
28+
29+
2. Install dependencies:
30+
```bash
31+
dotnet restore
32+
```
33+
34+
3. Configure your local settings:
35+
- Edit `local.settings.json`:
36+
```json
37+
{
38+
"IsEncrypted": false,
39+
"Values": {
40+
"AzureWebJobsStorage": "<Your Azure Storage Connection String>",
41+
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
42+
"SqlConnectionString": "<Your SQL Database Connection String>"
43+
}
44+
}
45+
```
46+
47+
4. Run the functions locally:
48+
```bash
49+
func start
50+
```
51+
52+
### Deployment 🚀
53+
1. Login to Azure CLI:
54+
```bash
55+
az login
56+
```
57+
58+
2. Create an Azure Function App:
59+
```bash
60+
az functionapp create --resource-group <ResourceGroupName> --consumption-plan-location <Region> --runtime dotnet --functions-version 4 --name <AppName> --storage-account <StorageAccountName>
61+
```
62+
63+
3. Deploy the application:
64+
```bash
65+
func azure functionapp publish <AppName>
66+
```
67+
68+
## Endpoints 📡
69+
70+
### Pie Chart Management 📊
71+
- **POST** `/api/PieChart/Add`
72+
- Add a new pie chart.
73+
- **DELETE** `/api/PieChart/Delete/{id:int}`
74+
- Delete a pie chart by ID.
75+
- **GET** `/api/PieChart/GetAll`
76+
- Fetch all pie charts.
77+
- **GET** `/api/PieChart/Get/{id:int}`
78+
- Retrieve a specific pie chart by ID.
79+
- **PUT** `/api/PieChart/Replace/{id:int}`
80+
- Replace a pie chart by ID.
81+
- **POST** `/api/PieChart/SendRandom`
82+
- Send random pie charts.
83+
84+
### 3D Points Management 🎯
85+
- **POST** `/api/3DPoints/Add`
86+
- Add a new 3D point.
87+
- **DELETE** `/api/3DPoints/Delete/{id:int}`
88+
- Delete a 3D point by ID.
89+
- **GET** `/api/3DPoints/GetAll`
90+
- Fetch all 3D points.
91+
- **GET** `/api/3DPoints/Get/{id:int}`
92+
- Retrieve a specific 3D point by ID.
93+
- **PUT** `/api/3DPoints/Replace/{id:int}`
94+
- Replace a 3D point by ID.
95+
- **POST** `/api/3DPoints/SendRandom`
96+
- Send random 3D points.
97+
98+
### User Management 👤
99+
- **POST** `/api/User/Add`
100+
- Add a new user.
101+
- **DELETE** `/api/User/Delete/{id:int}`
102+
- Delete a user by ID.
103+
- **GET** `/api/User/GetAll`
104+
- Retrieve all users.
105+
- **GET** `/api/User/GetByEmail`
106+
- Retrieve a user by email.
107+
- **GET** `/api/User/Get/{id:int}`
108+
- Retrieve a user by ID.
109+
- **GET** `/api/User/EmailExists`
110+
- Check if an email exists.
111+
- **PUT** `/api/User/Update/{id:int}`
112+
- Update user details by ID.
113+
114+
## SQL Schema 🗂️🛠
115+
The SQL database should include the following tables:
116+
117+
### PieCharts Table 📊
118+
| Column | Type | Description |
119+
|--------------|-------------|------------------------------|
120+
| Id | INT | Primary Key |
121+
| Name | VARCHAR(50) | Name of the pie chart |
122+
| Data | JSON | Data for the pie chart |
123+
| Timestamp | DATETIME | Last updated timestamp |
124+
125+
### Points Table 🗺️
126+
| Column | Type | Description |
127+
|--------------|-------------|------------------------------|
128+
| Id | INT | Primary Key |
129+
| X | FLOAT | X coordinate |
130+
| Y | FLOAT | Y coordinate |
131+
| Z | FLOAT | Z coordinate |
132+
| Timestamp | DATETIME | Last updated timestamp |
133+
134+
### Users Table 👤
135+
| Column | Type | Description |
136+
|--------------|-------------|------------------------------|
137+
| Id | INT | Primary Key |
138+
| Name | VARCHAR(50) | Name of the user |
139+
| Email | VARCHAR(50) | Email of the user |
140+
| Timestamp | DATETIME | Last updated timestamp |
141+
142+
## Contributing 🙌🤝🌟
143+
Contributions are welcome! Please submit issues and pull requests to help improve the API.
144+
145+
## License 📜🛡️🔓
146+
This project is licensed under the MIT License. See the `LICENSE` file for details.

0 commit comments

Comments
 (0)