Skip to content

judixon/PoSzkole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PoSzkole

Table of contents

General information

This application is dedicated to people and small businesses providing private lessons. Thanks to this solution, it's possible to solve main problems associated with running this kind of business like payment management, personal data management and lessons scheduling. The users of this application are categorized into three main roles: Teachers, Parents and Students. Each of these roles has its own, dedicated functionalities that helps them to cope with common issues and optimize whole business process.

Role description

  • Teacher - this is the main actor of whole application. Teachers are able to create new Students and Parents accounts and link them together. They can also create new Lesson Groups, manage them (e.g. add Students), create new Lessons linked to these Lesson Groups and manage these Lessons. Each Teacher account has its own Timetable which contains data of every Lesson which are automatically assigned to proper day of the week (represented by date) after being created. Teachers are also able to manage personal data of Parents and Students.
  • Student - this role is associated with every account belonging to student of the "school". Actually Students accounts are only able to check data of their Lesson Groups, Lessons linked with their Lesson Groups, Parents linked with them and Teachers which are linked to Lesson Groups they belong to.
  • Parent - this role is owned by each account which belong to legal guardian of a child being also a Student. Parents can be linked to many Students, while Student can be linked only to one Parent. Parents are able to check detailed data about their Students (same data as Student is allowed to see) and in addition they can see the data about Payments generated by their students taking part in Lessons. Parents can see an accumulated debt coming from unrealized Payments and their Wallet which can be top up by money and automatically cover unrealized Payments.
  • Admin - this role is dedicated to Teachers. Administrators can create Teachers Accounts and have access to whole data of the application. They are able to delete other accounts.

Functionalities

General:

  • Creating accounts of Teachers, Parents and Students.
    • Usernames must be unique.
  • Updating data of accounts.
    • When setting new username it also must be unique.
    • Students can be added to and removed from lesson groups and also they can be linked with parents - it must be done before conducting a lesson.
    • Parents wallet value can be top up and it will cause automatically an attempt of covering payments with status WAITING. List of students linked with parent can be also updated.
  • Deleting accounts
    • Deleting a student will remove him from all groups and lessons.
    • Deleting a parent will delete all his payments.
    • Deleting a teacher will leave all his groups without teacher - necessity of linking group with another teacher.
  • Displaying data of accounts and any functional objects of this application.
    • There are some constraints connected with access to the particular data which are clearly explained in Security paragraph.
  • User authentication and authorisation.

Lesson Group

  • Creating Lesson Group objects.
    • Each Lesson Group must have an assigned teacher initially.
    • Each Lesson Group initial status is INACTIVE - it actually means nothing for backend logic, but for example in clients application You can only display in timetable lessons which come from groups with status ACTIVE.
  • Updating data of Lesson Groups objects like name, subject, status, teacher owning the group, standard prize per lesson, lessons list and students list.
    • Adding student to the group would cause adding him to lessons linked with the group, but only when a lesson start date-time is after date-time of adding student to the group.
  • Setting an individual prize per lesson for each student if required (only when student is added to the group).
    • Students are stored in Lesson Groups in special objects called Student Lesson Group Buckets - these objects store data about individual prize per lesson for particular student and a boolean value (acceptIndividualPrize) which determine if the prize for payment generated from Lesson object is individual or standard.
  • Deleting Lesson Groups objects.
    • It causes a deletion of all Lesson objects connected witch particular Lesson Group and as a result, every Payment object connected with deleted Lesson object won't have ane information about lesson from which the payment comes from.

Lesson

  • Creating Lesson objects.
    • Lessons can be created only for the particular Lesson Group.
    • Date-time of start and end of the lesson must be set during creation.
    • There is a possibility to create a sequence of lessons only by one request. First of all You need to set date variable (lessonSequenceBorder) which is the border of the lesson sequence - lessons would be created only up to this date. Next variable which is necessary to be set is frequency status (LessonFrequencyStatus) which accpets following values: EVERY_WEEK (lessons will be created every week, the same day and time of the week) and EVERY_SECOND_WEEK (lessons will be created every second week, the same day and time of the week).
    • If You want to create just a single lesson, just specify start and end date-time and set lesson frequency status to SINGLE - that setting will ignore value of LessonSequenceBorder.
    • All students belonging to the group will by automatically added to all lessons which date-time of starting is after date-time of creating lessons - so students won't be added to lessons that are created for the past and as a result, unable to be realized.
    • Each new Lesson object initial status is WAITING - it can be changed into DONE or CANCELED. These values aren't connected with any backend functionality, but they would be used for statistics module in the future, so actually it's only information data.
  • Updating data of Lesson object like plan of the lesson, notes and lesson status.
  • Setting student presence status in particular lesson.
    • Students are stored in Lessons in special objects called Student Lesson Buckets - these objects store data about student presence status and variable connected with this value (StudentPresenceStatus) accepts following values: PRESENT_PAYMENT, ABSENT_PAYMENT (for these two values, payments are automatically generated and saved in Parents account which is linked with the student, if there is enought money in parents wallet, these payments are automatically covered - switching from PRESENT_PAYMENT to ABSENT_PAYMENT and in the opposite way, won't generate additional payment), PRESENT_NO_PAYMENT, ABSENT_NO_PAYMENT, UNDETERMINED (for these three values, payment aren't generated, but if they were already generated, they are deleted and if they were already paid, the money is restored to parent account - parents debt is refreshed).
  • Deleting Lesson objects.
    • Lessons will be removed from teacher timetable and students data and all payments connected with that lesson won't have any information about that lesson.

Payment

  • Creating Payment objects.
    • Payments can be added manually, not only generated automatically after setting students presence status in the particular lesson.
    • Each new Payment generated automatically has status WAITING and it's changing into DONE after covering payment. Creating payment manually allow to set any status of payment, even CANCELED.
  • Deleting Payment objects.
    • Payment objects can be deleted and removed from parents payment list as a result.
  • Covering payments.
    • Payments are cover automatically when parents account is updated (e.g. setting new wallet value) and when new payment appears (if there is enough money in wallet, the payment is covered).

Technologies

  • Java 17
  • Spring Boot 2.7.4
  • Spring Data
  • Spring Security
  • Project Lombok
  • PostgreSQL
  • H2 Database
  • JUnit 5
  • Mockito

Tools

  • IntelliJ IDEA
  • Postman
  • Swagger
  • Maven
  • Docker

Security information

In tables below, there are information about roles demanded from accounts requesting particular resource (endpoint).

/teachers

Endpoint Http method Roles Additional constraints
/teachers GET ADMIN, TEACHER, PARENT, STUDENT -/-
/teachers POST ADMIN -/-
/teachers/{teacher-id} GET ADMIN, TEACHER, PARENT, STUDENT -/-
/teachers/{teacher-id} DELETE ADMIN -/-
/teachers/{teacher-id} PATCH ADMIN -/-
/teachers/{teacher-id}/homeworks GET ADMIN, TEACHER * TEACHER has access to resource only if requesting account ID is equal to teacherId
/teachers/{teacher-id}/lessongroups GET ADMIN, TEACHER * TEACHER has access to resource only if requesting account ID is equal to teacherId
/teachers/{teacher-id}/timetable GET ADMIN, TEACHER * TEACHER has access to resource only if requesting account ID is equal to teacherId

/parents

Endpoint Http method Roles Additional constraints
/parents GET ADMIN, TEACHER -/-
/parents POST ADMIN -/-
/parents/{parent-id} GET ADMIN, TEACHER, PARENT * PARENT has access to resource only if account ID is equal to parentID
/parents/{parent-id} DELETE ADMIN -/-
/parents/{parent-id} PATCH ADMIN -/-
/parents/{parent-id}/payments GET ADMIN, TEACHER, PARENT * PARENT has access to resource only if account ID is equal to parentID
/parents/{parent-id}/students GET ADMIN, TEACHER, PARENT * PARENT has access to resource only if account ID is equal to parentID
/parents/{parent-id}/students/{student-id} GET ADMIN, TEACHER, PARENT * PARENT has access to resource only if account ID is equal to parentID

/students

Endpoint Http method Roles Additional constraints
/students GET ADMIN, TEACHER -/-
/students POST ADMIN -/-
/students/{student-id} GET ADMIN, TEACHER, PARENT, STUDENT * PARENT has access to resource only if account with requested studentId is linked with requesting parent account
* STUDENT has access to resource only if requesting account ID is equal to studentId
/students/{student-id} DELETE ADMIN -/-
/students/{student-id} PATCH ADMIN -/-
/students/{student-id}/lessons GET ADMIN, TEACHER, PARENT, STUDENT * PARENT has access to resource only if account with requested studentId is linked with requesting parent account
* STUDENT has access to resource only if requesting account ID is equal to studentId
/students/{student-id}/homeworks GET ADMIN, TEACHER, PARENT, STUDENT * PARENT has access to resource only if account with requested studentId is linked with requesting parent account
* STUDENT has access to resource only if requesting account ID is equal to studentId
/students/{student-id}/parent GET ADMIN, TEACHER, PARENT, STUDENT * PARENT has access to resource only if account with requested studentId is linked with requesting parent account
* STUDENT has access to resource only if requesting account ID is equal to studentId
/students/{student-id}/lesson-groups GET ADMIN, TEACHER, PARENT, STUDENT * PARENT has access to resource only if account with requested studentId is linked with requesting parent account
* STUDENT has access to resource only if requesting account ID is equal to studentId

/lesson-groups

Endpoint Http method Roles Additional constraints
/lesson-groups GET ADMIN, TEACHER -/-
/lesson-groups POST ADMIN, TEACHER -/-
/lesson-groups/{lesson-group-id} GET ADMIN, TEACHER -/-
/lesson-groups/{lesson-group-id} DELETE ADMIN -/-
/lesson-groups/{lesson-group-id} PATCH ADMIN, TEACHER -/-
/lesson-groups/{lesson-group-id}/lessons GET ADMIN, TEACHER, PARENT, STUDENT * STUDENT has access to resource if he belongs to requested lesson group
* PARENT has access to resource if one of students linked with his account belongs to requested lesson group
/lesson-groups/{lesson-group-id}/teacher GET ADMIN, TEACHER, PARENT, STUDENT * STUDENT has access to resource if he belongs to requested lesson group
* PARENT has access to resource if one of students linked with his account belongs to requested lesson group
/lesson-groups/{lesson-group-id}/students GET ADMIN, TEACHER, PARENT, STUDENT * STUDENT has access to resource if he belongs to requested lesson group
* PARENT has access to resource if one of students linked with his account belongs to requested lesson group
/lesson-groups/{lesson-group-id}/student-lesson-group-buckets/{student-lesson-group-bucket-id} DELETE ADMIN, TEACHER -/-
/lesson-groups/{lesson-group-id}/student-lesson-group-buckets/{student-lesson-group-bucket-id} PATCH ADMIN, TEACHER -/-

/lessons

Endpoint Http method Roles Additional constraints
/lessons GET ADMIN, TEACHER -/-
/lessons POST ADMIN, TEACHER -/-
/lessons/{lesson-id} GET ADMIN, TEACHER * TEACHER has access to resource only if lesson is linked with lesson groups which owner is requesting teacher
/lessons/{lesson-id} DELETE ADMIN, TEACHER * TEACHER has access to resource only if lesson is linked with lesson groups which owner is requesting teacher
/lessons/{lesson-id} PATCH ADMIN, TEACHER * TEACHER has access to resource only if lesson is linked with lesson groups which owner is requesting teacher
/{lesson-id}/student-lesson-buckets/{student-lesson-bucket-id} PATCH ADMIN, TEACHER * TEACHER has access to resource only if lesson is linked with lesson groups which owner is requesting teacher

/payments

Endpoint Http method Roles Additional constraints
/payments GET ADMIN, TEACHER -/-
/payments POST ADMIN -/-
/payments/{payment-id} GET ADMIN, TEACHER -/-
/payments/{payment-id} DELETE ADMIN -/-

Api documentation

Detailed API documentation is provided by Swagger. If You want to see it in a raw JSON version, just run the application and enter the link given below:

http://localhost:8081/v2/api-docs

You can also check it out in more visually pleasant version in the link below:

http://localhost:8081/swagger-ui/index.html#/

Test data

For test purpose there is a class which initialize test data. It adds 4 users to the database, which are:

  1. [ADMIN, TEACHER] username: teacheradmin password: tacheradmin
  2. [TEACHER] username: teacher password: teacher
  3. [STUDENT] username: student password: student
  4. [PARENT] username: parent password: parent

You can find class initializing data by the following path:

src/main/java/com/tomekw/poszkole/DataInitialization.java

##Docker image You can download docker image with this application by pulling it from Docker Hub using the command below:

docker pull judixon/poszkole:v1

And then run it using the next command:

docker run -e "SPRING_PROFILES_ACTIVE=dev" -p 80:8081 judixon/poszkole:v1

You can also change environment variable SPRING_PROFILES_ACTIVE to "prod" but then the application need to run with configured connection with PostgreSQL database. For the test purposes I recommend to create container with default "dev" profile (H2 database).

Plans for future

  • Input data validation - actually inputted data isn't validated. It isn't huge problem because now, only teacher are able to update or create data so the input is somehow controlled by responsible users.
  • Mailbox - this functionality will provide internal mailbox which would be used for comunication mainly between teachers and students. This functionality will also allow teachers to handle homeworks and additional study materials. (The template of this functionality already exists in project, but haven't been completely implemented yet.)
  • Homeworks - this functionality will provide possibility of handling homeworks to students by teachers and to send solutions of these homeworks by students in text or by uploading graphic files. (The template of this functionality already exists in project, but haven't been completely implemented yet.)
  • Keyclock - actual authentication process is provided by Basic Auth. It's outdated solution, so there is a need to provide authentication by different identity and access management solution like Keycloak.
  • Notifications - this functionality will allow application to inform parents and students by email or SMS about canceled or rescheduled lessons, unpaid lessons, too high debt on parents account.
  • Business Intelligence / Statistics panel - this functionality will provide the possibility of controlling primary statistics like monthly or annual incomes, in the past or predicted incomes based on planned lessons. It would also allow seeing statistics connected with exact students like their attendance to lessons or past and future incomes from student.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages