-
Reusability and genetic algorithm
- The genetic algorithm is a search heuristic that mimics the process of natural selection. This heuristic is routinely used to generate useful solutions to optimization and search problems. Genetic algorithms belong to the larger class of evolutionary algorithms (EA), which generate solutions to optimization problems using techniques inspired by natural evolution, such as inheritance, mutation, selection, and crossover.
In this case study, a study was conducted to create the best lesson plan using a genetic algorithm. By using a modular structure in this study, the reusability of the code was ensured.
└── src
├── app.module.ts
├── main.ts
├── modules
│ ├── schedule
│ │ ├── schedule.module.ts
│ │ ├── schedule.controller.ts
│ │ ├── schedule.service.ts
│ │ ├── dto
│ │ │ ├── lookup.dto.ts
├── shared
│ ├── http-exception.filter.ts
│ └── ...
└── config
│ └── db.config.ts
│── interceptors
│ └── serialize.interceptor.ts
│── subscribers
│ └── every.event.subscriber.ts
│── repository
│ └── schedule.repo.ts
│── inheritance
│ └── algorithms
│ └── genetic-alg.ts
│ └── bestSchedule.ts
│── entities
│ └── schedule.entity.ts
│── decorators
│ └── response.message.ts
│ └── try.catch.ts
- Schedule Endpoint:
- Endpoint:
/api/v1/schedules
- Method:
POST
- Get All Schedule Endpoint:
- Endpoint:
/api/v1/schedules
- Method:
GET
- Request Query:
{ "limit": "---", "page": "----", }
-
Swagger UI: The project's API documentation is generated using Swagger. Swagger is a tool used to automatically generate and serve API documentation.
-
URL:
https://localhost:8000/api/v1/docs
-
Custom Repositories: Custom repositories were utilized for database operations.
-
Transactions: Transactions were used to manage operations atomically.
-
Entity Listeners and Subscribers: Entity listeners and subscribers were employed to define custom behaviors that will automatically execute during database operations.
-
DTOs for Response: Data Transfer Objects (DTOs) were employed for defining response models.
- Objects specified in DTOs: The objects defined in DTOs were returned as responses, providing a structured and tailored data format to clients.
-
#1:) for local development
-
-
When we run our project with Docker in the production environment or locally, global packages will be installed automatically. Entering these commands is sufficient only for our team members who will run it for the first time locally without docker.
git clone or git pull
npm i
- please check the
.env
file for the environment variables. if it not exist please create it. npm run start:dev
-
requiremet env value for local development
- DB_NAME=postgres
- SYNCHRONIZE=true
- DB_HOST=localhost
- DB_PORT=5432
- DB_PASS=postgres
- DB_USER=postgres
- DB_NAME=postgres
- COOKIE_KEY=usYvcPuTTZnafZKrEDIi
- DB_TYPE=postgres
- MIGRATIONS_RUN=true
- LOGGING=true
-
-
-
- Data for classrooms, levels, subjects, and teachers is populated in the database using migrations. The following commands are used to manage migrations:
- Create Migration:
npm run typeorm:create-migration
- Run Migrations:
npm run typeorm:run-migrations
- Revert Migrations:
npm run typeorm:revert-migrations
- Create Migration:
- Data for classrooms, levels, subjects, and teachers is populated in the database using migrations. The following commands are used to manage migrations:
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Nurettin Şen - - [email protected]