RESTful API Backend – Electrical Equipment Information in Can Tho Power Company
Serverless backend on Azure Functions for electrical testing process management at Can Tho Power Corporation (PCCT). Supports the full lifecycle: testing requests, construction & equipment management, file storage, document signing, and SMS notifications. Acts as the infrastructure platform layer for web, mobile, and partner integrations.
Context: Digital transformation — backend API for internal and external applications
Overview
The Electrical Testing Digital Transformation PCCT system is a serverless backend solution built on Azure Functions, serving electrical testing process management for Can Tho Power Corporation (PCCT). The system supports the full lifecycle from accepting testing requests, managing construction projects & equipment, file storage, document signing to customer SMS notifications.
Data separation architecture: Uses SQL Server and ASP.NET RESTful API for internal user management and authentication. After successful authentication, the system calls Azure Functions (FunctionApp) to query and store electrical equipment and construction data in Cosmos DB – suitable for large data volumes, ensuring performance and scalability.
This API Backend serves as a critical infrastructure platform layer, providing the backend platform for other application components (web app, mobile app, partner integrations, etc.) to connect and operate.
Main Features
| Module | Description |
|---|---|
| Construction Management | CRUD construction projects, basic and advanced search (constructionName, constructionAddress, managementUnit, requestContent, staffName, dateFrom – dateTo), equipment catalog per construction, construction library. |
| Request / Ticket Management | Testing request registration, CRUD tickets by ID and phone number (partition key), status PENDING → ACCEPTED, processing history, link to construction via TAG. |
| Equipment Management | CRUD equipment tied to constructionId, test data list (testDataList), equipment library (templates and common data). |
| User Management | CRUD staff (SQL Server – internal users), login via ASP.NET API (employee ID and password), staff information. |
| File Management | Upload/download Base64 files in Azure Blob Storage by id, list files in container. |
| Document Signing (KYSO) | Create digital documents (BBTN, Detailed Calculation, etc.), auto document numbering ({number}/PCCT-KT-{documentType}), multi-turn signing (PENDING SIGNATURE → PENDING RELEASE → RELEASED), query by tag/signer/date/Admin, signature image storage. |
| Customer API | Public API for partners: query construction by month/year, equipment by constructionId. |
| Utility Services | Check IP (Viettel), Send SMS via Viettel SOAP API (AMS Branded Messaging). |
Screenshots
System architecture
Figure: System architecture overview
Development — Visual Studio
TicketService (CreateTicket, GetTicket, UpdateTicket) and Solution Explorer: CONGTRINH, TICKET, THIETBI, USER, FILE, KYSO, CUSTOMERS, Services.
Figure: FunctionApp_ThiNghiemDienPCCT — TicketService and Solution Explorer
API services on cloud
Figure: API services stored on cloud
Azure Storage — Image files
Figure: Azure Storage stores image files from API
Azure Function API — Services
Figure: Services on Azure Function API
Technology Stack
| Category | Technology |
|---|---|
| Runtime | .NET 8 |
| Main backend | Azure Functions v4 (HTTP Trigger) |
| Auth API | ASP.NET RESTful API |
| Database | SQL Server (internal users), Azure Cosmos DB (large data: construction, equipment) |
| File storage | Azure Blob Storage |
| SMS | Viettel Bulk SMS (SOAP) |
| JSON | Newtonsoft.Json |
System Architecture
ASP.NET API + SQL Server: Manages internal users, handles login and Bearer Token issuance.
Azure Functions + Cosmos DB: After authentication, clients call FunctionApp to query and store construction and electrical equipment – leveraging Cosmos DB’s large data handling.
Blob Storage: Stores files, digital documents, signature images.
Viettel SMS: Sends SMS notifications.
┌─────────────────────┐ Bearer Token ┌─────────────────────────────────┐
│ ASP.NET API │ ───────────────────▶ │ Azure Functions (large data) │
│ (Authentication & │ │ ConstructionAPI │ EquipmentAPI │ …
│ Internal users) │ └─────────────────────────────────┘
└─────────────────────┘ │
│ ▼
▼ ┌───────────────┐
┌───────────────┐ │ Cosmos DB │
│ SQL Server │ │ (Construction,│
│ (User) │ │ Equipment) │
└───────────────┘ └───────────────┘
Layer model: API Layer (Azure Functions HTTP Trigger – validate Bearer Token, call Service); Service Layer (business logic, Cosmos DB & Blob Storage).
Service Overview
- ConstructionService: CRUD construction, basic and advanced search with pagination, construction library.
- TicketService: CRUD request tickets, management by phone number, delete with Blob container.
- EquipmentService: CRUD equipment linked to construction, equipment templates and common data.
- UserService: CRUD staff, login (can integrate SQL Server for internal users).
- FileService: Upload, download Base64 files, list files by container.
- SignService (KYSO): Digital document lifecycle (create, sign, release), multi-condition query, download files and signatures.
- CustomersService: Query construction by month/year, equipment by constructionId for public API.
Security
- Bearer Token: Internal APIs use
Authorization: Bearer {token}for authentication. Token is issued after successful login via ASP.NET API. - Customers API: No token required, serves public lookup by month/year and constructionId.
Main Data Models
Construction, Ticket, Equipment, Document (digital document), User.