This is a backend service for Attendance Platform. Attendance Platform is used by employees to be able to log their attendance. Employees can check in and check out attendance. Employees will be able to create, edit, and delete some activities for attendance after checking in. Getting activity history by date and getting attendance history are some of the other features. Live demo https://attendance-platform.herokuapp.com/api/docs.
Create .env file in the root directory of your project. Add environment-specific variables on new lines in the form NAME=VALUE. For example:
- DB_HOST=localhost
- DB_PORT=5432
- DB_USER=root
- DB_PASS=password123
- DB_NAME=attendancedb
- TOKEN_HOUR_LIFESPAN=24
- SECRET_KEY=secret123
You need PostgreSQL = 14
server running.
go run main.go
- Go 1.18
- PostgreSQL 14
- Gin Web Framework
- GORM
- Swagger 2.0
- JSON Web Token
- Employee were be able to register and login.
- Employee were be able to check in attendance.
- Employee were be able to add activity.
- Employee were be able to edit activity.
- Employee were be able to delete activity.
- Employee were be able to check out attendance.
- Employee were be able to get activities history by date.
- Employee were be able to get attendance history.
- Employee were be able to logout.
The design contains several layers and components and very much similar to onion or clean architecture attempt.
- Controllers
- Services
- Repositories
Controllers is where all the http handlers exist. This layer is responsible to hold all the http handlers and request validation.
Services mediates communication between a controller and repository layer. The service layer contains business logic.
Repositories is for accessing the database and helps to extend the CRUD operations on the database.