module
0.0.0-20250110163239-ba54650fdb0f
Repository: https://github.com/shashank78456/mvc.git
Documentation: pkg.go.dev
# README
Library Management System
- Setting up
- Clone the repo using
git clone https://github.com/shashank78456/mvc.git
. - Go to root directory of the repo.
cd mvc
. - Execute
chmod +x ./setup.sh
. - Run
./setup.sh
.
- Running Server
- Run
make migrate_up
and Press Enter. - Execute
chmod +x run.sh
- Run
./run.sh
.
- Run using Docker
- Ensure docker is installed and running
- Execute
chmod +x ./docker_env_setup.sh
. - Run
./docker_env_setup.sh
. - Run
docker-compose up --build
- Unit Tests
There are two test files:
users_test.go
which testsfunc GetUserType(string) (int, error)
of users modelauth_test.go
contains benchmark tests forfunc createToken(string, string) (string, error)
,func HashPassword(string, string) (string, error)
,func IsPasswordValid(string, string) (bool)
of auth.go in controller
To run users_test.go
:
cd pkg/models
go test -v
To run auth_test.go
:
cd pkg/controller
go test -bench=.
- Project Specs
The first user to signup has superadmin privileges. Only superadmin can accept or deny clients seeking admin privileges. Users cannot signup as admin.
Clients can borrow books by making a borrow request which needs to be approved by an admin. Clients can return books and access their borrow history. Clients can request for admin privileges.
Admins can approve borrow requests, add new books in the catalog, make a book available for borrowing or disable borrowing of a book.