Skip to content

cgaritac/performance_evaluation_system_BE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Performance Evaluation System - Backend

A comprehensive REST API backend system for managing employee performance evaluations, goals, and activities. Built with ASP.NET Core 8.0, featuring Azure AD authentication, MySQL database integration, and a clean architecture pattern.

πŸ“‹ Table of Contents

🎯 Overview

This backend system provides a robust API for managing performance evaluations in an organization. It enables administrators and employees to track goals, monitor activities, and conduct annual performance reviews with a comprehensive workflow management system.

Key Capabilities

  • Employee Management: Maintain employee records with department assignments
  • Performance Evaluations: Create and manage annual performance evaluations
  • Goal Tracking: Define, track, and manage employee goals with different categories and statuses
  • Activity Management: Associate activities with goals to track progress
  • Role-Based Access Control: Secure API endpoints with Azure AD authentication and role-based authorization
  • Soft Delete: Preserve data integrity with soft delete functionality
  • Pagination: Efficient data retrieval with paginated responses

✨ Features

  • βœ… RESTful API architecture
  • βœ… Azure AD integration for authentication
  • βœ… Entity Framework Core with MySQL
  • βœ… Repository pattern for data access
  • βœ… Service layer for business logic
  • βœ… DTOs for request/response mapping
  • βœ… Global exception handling middleware
  • βœ… CORS configuration
  • βœ… Swagger/OpenAPI documentation
  • βœ… Structured logging with Serilog
  • βœ… Soft delete implementation
  • βœ… Audit fields (CreatedBy, UpdatedBy, DeletedBy, etc.)
  • βœ… Azure Pipelines CI/CD integration

πŸ›  Technology Stack

  • Framework: ASP.NET Core 8.0
  • Database: MySQL (via Pomelo.EntityFrameworkCore.MySql)
  • ORM: Entity Framework Core 8.0.13
  • Authentication: Microsoft Identity Web 3.9.2 (Azure AD)
  • Logging: Serilog.AspNetCore 9.0.0 with MySQL sink
  • Documentation: Swashbuckle.AspNetCore 8.1.2
  • CI/CD: Azure DevOps Pipelines

πŸ— Architecture

The project follows a clean architecture with clear separation of concerns:

β”œβ”€β”€ Controllers/          # API endpoints
β”œβ”€β”€ Services/             # Business logic layer
β”œβ”€β”€ Repositories/         # Data access layer
β”œβ”€β”€ Models/               # Domain models and DTOs
β”œβ”€β”€ Interfaces/           # Service and repository contracts
β”œβ”€β”€ Data/                 # DbContext and database configuration
β”œβ”€β”€ Middleware/           # Custom middleware (Exception, CORS)
β”œβ”€β”€ Extensions/           # Extension methods for configuration
β”œβ”€β”€ Utils/                # Helpers, constants, enums, mappers
└── Configurations/       # Dependency injection setup

Design Patterns

  • Repository Pattern: Abstracts data access logic
  • Service Pattern: Encapsulates business logic
  • DTO Pattern: Separates API contracts from domain models
  • Dependency Injection: Loosely coupled components
  • Middleware Pattern: Cross-cutting concerns (logging, exceptions)

πŸš€ Getting Started

Prerequisites

  • .NET 8.0 SDK
  • MySQL Server 8.0 or higher
  • Azure AD App Registration (for authentication)

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/performance_evaluation_system_BE.git
cd performance_evaluation_system_BE
  1. Restore NuGet packages:
dotnet restore
  1. Configure appsettings.json:

    • Set up MySQL connection string
    • Configure Azure AD settings
    • Configure Serilog settings
  2. Run database migrations (if using EF migrations):

dotnet ef database update
  1. Build and run the project:
dotnet build
dotnet run --project PACE/PACE.csproj

The API will be available at https://localhost:5001 (or configured port).

  1. Access Swagger documentation: Navigate to https://localhost:5001/swagger to explore the API endpoints.

πŸ“‘ API Endpoints

Employees

  • GET /api/Employees - Get paginated list of employees (Admin only)
  • GET /api/Employees/{id} - Get employee by ID
  • POST /api/Employees - Create new employee
  • PUT /api/Employees/{id} - Update employee
  • DELETE /api/Employees/{id} - Soft delete employee

Evaluations

  • GET /api/Evaluations - Get paginated list of evaluations (Admin only)
  • GET /api/Evaluations/withgoals/{employeeid} - Get evaluation with goals by employee ID and year
  • POST /api/Evaluations/all - Create evaluations for multiple employees (Admin only)
  • PUT /api/Evaluations/idemployee/{employeeid} - Update evaluation (Admin only)

Goals

  • GET /api/Goals/{id} - Get goal by ID
  • POST /api/Goals - Create new goal
  • PUT /api/Goals/{id} - Update goal
  • DELETE /api/Goals/{id} - Soft delete goal

Activities

  • GET /api/Activities/{id} - Get activity by ID
  • POST /api/Activities - Create new activity
  • PUT /api/Activities/{id} - Update activity
  • DELETE /api/Activities/{id} - Soft delete activity

Note: All endpoints require authentication. Some endpoints have role-based restrictions (Admin/User).

βš™οΈ Configuration

appsettings.json

Key configuration sections:

{
  "AzureAd": {
    "Instance": "https://login.microsoftonline.com/",
    "ClientId": "your-client-id",
    "TenantId": "your-tenant-id"
  },
  "ConnectionStrings": {
    "AppConnection": "server=...;user=...;database=...;port=...;password=...;"
  },
  "Serilog": {
    // Logging configuration
  }
}

Environment Variables

For production, use environment variables or Azure Key Vault to store sensitive configuration.

πŸ—„ Database

Entity Relationships

Employee (1) ──→ (N) Evaluation
Evaluation (1) ──→ (N) Goal
Goal (1) ──→ (N) Activity

Key Entities

  • Employees: Employee information with department assignment
  • Evaluations: Annual performance evaluations with feedback
  • Goals: Employee goals with categories, types, and status tracking
  • Activities: Activities associated with goals to track progress

Soft Delete

All entities implement soft delete functionality with:

  • IsActive flag
  • DeletedBy and DeletedOn audit fields
  • Automatic filtering of deleted records

πŸ” Authentication & Authorization

The API uses Azure AD for authentication:

  • Azure AD Integration: Microsoft Identity Web
  • Roles:
    • Admin: Full access to all endpoints
    • User: Limited access to employee-specific data
  • Token Validation: Automatic token validation via middleware
  • Authorization: Role-based authorization on controllers

Required Setup

  1. Register application in Azure AD
  2. Configure redirect URIs
  3. Set up API permissions
  4. Configure app roles (Admin, User)

πŸ“ Logging

Structured logging implemented with Serilog:

  • Sinks: Console and MySQL
  • Log Levels: Configurable per namespace
  • Enrichment: Machine name, thread ID, context
  • Storage: Logs stored in MySQL database

Configure log levels in appsettings.json under the Serilog section.

πŸ”„ CI/CD

Azure DevOps Pipeline configured for automated deployment:

  • Trigger: Push to main branch
  • Build: .NET build and publish
  • Deploy: Automatic deployment to Azure Web App (Linux)
  • Runtime: .NET Core 8.0

Pipeline file: azure-pipelines.yml

πŸ“ Project Structure

PACE/
β”œβ”€β”€ Controllers/          # API Controllers
β”‚   β”œβ”€β”€ ActivitiesController.cs
β”‚   β”œβ”€β”€ EmployeesController.cs
β”‚   β”œβ”€β”€ EvaluationsController.cs
β”‚   β”œβ”€β”€ GoalsController.cs
β”‚   └── ErrorsController.cs
β”‚
β”œβ”€β”€ Services/             # Business Logic
β”‚   β”œβ”€β”€ ActivityService.cs
β”‚   β”œβ”€β”€ EmployeeService.cs
β”‚   β”œβ”€β”€ EvaluationService.cs
β”‚   β”œβ”€β”€ GoalService.cs
β”‚   └── UserService.cs
β”‚
β”œβ”€β”€ Repositories/         # Data Access
β”‚   β”œβ”€β”€ ActivityRepository.cs
β”‚   β”œβ”€β”€ EmployeeRepository.cs
β”‚   β”œβ”€β”€ EvaluationRepository.cs
β”‚   └── GoalRepository.cs
β”‚
β”œβ”€β”€ Models/               # Domain & DTOs
β”‚   β”œβ”€β”€ ActivityModels/
β”‚   β”œβ”€β”€ EmployeeModels/
β”‚   β”œβ”€β”€ EvaluationModels/
β”‚   β”œβ”€β”€ GoalModels/
β”‚   └── CommonModels/
β”‚
β”œβ”€β”€ Data/
β”‚   └── PaceDbContext.cs
β”‚
β”œβ”€β”€ Middleware/
β”‚   β”œβ”€β”€ ExceptionMiddleware.cs
β”‚   └── CorsMiddleware.cs
β”‚
β”œβ”€β”€ Utils/
β”‚   β”œβ”€β”€ Constants/
β”‚   β”œβ”€β”€ Enums/
β”‚   β”œβ”€β”€ Helpers/
β”‚   └── Mappers/
β”‚
└── Configurations/
    β”œβ”€β”€ DependencyInjection.cs
    └── ServiceConfiguration.cs

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

This project is private and owned by CGC. All rights reserved.

πŸ‘₯ Team

Developed by CGC


⭐ If this project has been useful to you, consider giving it a star on GitHub.

About

A performance evaluation system build with .Net 8 (Back end)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages