Skip to content

feat: scope notion, admin UI and csv export #36

Closed
TsioryJonathan wants to merge 49 commits into
preprodfrom
feat/admin-csv-scope
Closed

feat: scope notion, admin UI and csv export #36
TsioryJonathan wants to merge 49 commits into
preprodfrom
feat/admin-csv-scope

Conversation

@TsioryJonathan

@TsioryJonathan TsioryJonathan commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR adds several major features to the payment management system.

Features

  • Scope field — New scope column on payments with filtering in both the Web UI and CSV export
  • OAuth2 authentication via Casdoor — Admins sign in with their institutional email, validated against a VOLA_ADMINS whitelist
  • Payment Web UI — Thymeleaf dashboard with stats cards (total collected, payment count, pending count), paginated table, date/application/scope filters, and logout dialog
  • CSV export — Export filtered payments per application with proper escaping

Tests

  • Repository filter integration tests
  • Service layer tests for filtering, pagination, CSV build
  • Web MVC tests for the payment view controller
  • Unit tests for the admin email checker

TsioryJonathan and others added 29 commits June 23, 2026 09:54
* build: add new deps

* chore: add application.yml config for casdoor

* chore: add security config for casdoor

* chore: add admin checker utility

* fix: only match the /payment endpoint to be authenticated

* fix: deny all unknown route since every route are matched

* fix: replace HttpServletRespnose with Spring default 403 error.

* fix: change to constructor injection

* chore: add test for vola admin checker

* chore: put back to the default generated code
* chore: untrack .env

* feat: create application not found exception

* feat: can now search all application payment with GET /payments?applicationName={}&apiKey={}

* feat: add CSV export for payments by application with optional date range

* refactor: move buildCsv method into service and format code

* fix: handle case when only one date is given

* feat: add comprehensive tests for payment export and lookup by application

* feat: add controller tests for CSV export endpoint

* chore: format

* feat: add repository tests for findByApplicationNameAndCreationInstantBetween

---------

Co-authored-by: colombefioren <colomberakotonjanahary@gmail.com>
* feat : implement header for vola with email and log out button

* feat : find all methods for all application

* feat : controller for /payments page

* fix : fix PaymentViewController syntax

* feat : payments page with filter and button export
* feat: add VolaController for /payments page

* feat: add Thymeleaf export form for CSV download

* feat: add admin verification on CSV export endpoint

* fix: add test defaults for Casdoor OAuth2 properties

* fix: redirect Casdoor provider to casdoor-test in tests to avoid OIDC discovery

* fix: remove redundant admin check in exportPaymentsCsv

* feat: replace VolaController with PaymentViewController

* feat: add payment history table, stats cards and export button

* feat: add findAll methods to PaymentRepository and PaymentService

* fix: add default model attributes when no app selected, fix swapped columns

* fix: parse date params as String to prevent 500 on empty date fields

* chore: format

* fix: use th:with to compute border color before th:style

* fix: replace th:style with CSS classes for status border colors

* fix: remove unused methods

* fix: allow null applicationName in JPQL query for 'all' filter

* fix: pass null to service when 'all' applications selected

* fix: change 'all apps' option value from empty to 'all'

* fix: handle 'all' applicationName in CSV export

* fix: show all payments by default on /payments

* chore: format

---------

Co-authored-by: Mathieu-bot <mathieu-bot@users.noreply.github.com>
* feat: add VolaController for /payments page

* feat: add Thymeleaf export form for CSV download

* feat: add admin verification on CSV export endpoint

* fix: add test defaults for Casdoor OAuth2 properties

* fix: redirect Casdoor provider to casdoor-test in tests to avoid OIDC discovery

* fix: remove redundant admin check in exportPaymentsCsv

* feat: replace VolaController with PaymentViewController

* feat: add payment history table, stats cards and export button

* feat: add findAll methods to PaymentRepository and PaymentService

* fix: add default model attributes when no app selected, fix swapped columns

* fix: parse date params as String to prevent 500 on empty date fields

* chore: format

* fix: use th:with to compute border color before th:style

* fix: replace th:style with CSS classes for status border colors

* fix: remove unused methods

* fix: allow null applicationName in JPQL query for 'all' filter

* fix: pass null to service when 'all' applications selected

* fix: change 'all apps' option value from empty to 'all'

* fix: handle 'all' applicationName in CSV export

* fix: show all payments by default on /payments

* chore: format

* feat: add DateUtils.parseDate utility class

* refactor: use DateUtils.parseDate instead of private method

* refactor: handle 'all' applicationName in service layer

* refactor: remove effectiveApp logic from export endpoint

---------

Co-authored-by: Mathieu-bot <mathieu-bot@users.noreply.github.com>
…#6)

* feat: rename DateUtils to DateParser

* chore: remove DateUtils.java replaced by DateParser

* refactor: use DateParser instead of DateUtils

* test: add tests for findAll with appName=all

* test: add export CSV tests with appName=all

* fix: remove fragile count assertion in all-app test

* fix: restore size >= 2 assertion in all-app test

---------

Co-authored-by: Mathieu-bot <mathieu-bot@users.noreply.github.com>
* chore: untrack .env

* feat: add pagination for payment and use separated method to compute stats

* fix: sort payment by creationDatetime
* feat: rename DateUtils to DateParser

* feat: add logout confirmation dialog modal

* style: add dialog modal and backdrop animations

* chore: add spring-security-test dependency

* test: verify logout dialog renders in /payments page

* fix: move dialog inside header fragment so Thymeleaf renders it

* fix: redirect to / after logout and allow anonymous access to /

* fix: use oidcLogin() post-processor instead of @WithOidcUser

* chore: format

---------

Co-authored-by: Mathieu-bot <mathieu-bot@users.noreply.github.com>
* feat: add scope column to payment table

* feat: add scope field to Payment domain record

* feat: add scope field to JPayment entity

* feat: map scope in JPaymentMapper

* feat: add scope param to PaymentRepository methods

* feat: add scope filter to JPA queries

* feat: add scope to PaymentService methods

* feat: add scope param to payment REST endpoint

* feat: add scope filter to payments page controller

* feat: add scope column and filter to payments UI

* test: update tests for scope parameter

* fix: use criteria builder for case insensitive scope search
* feat: add logout confirmation dialog modal

* fix: move dialog inside header fragment so Thymeleaf renders it

* style: migrate violet to red in header..html

* style: migrate violet to red in payments.html

* style: update title color

* style: add icons

* fix(security): permit static resource paths in security configuration

* style: compact dialog keyframes and add stat-card gradient backgrounds

* style: redesign header with material icons and updated color scheme

* style: redesign stat cards with gradient backgrounds and hover effects

* style: remove hover transitions on stat cards and make filter fields responsive

---------

Co-authored-by: Mathieu-bot <mathieu-bot@users.noreply.github.com>
* feat: add logout confirmation dialog modal

* fix: move dialog inside header fragment so Thymeleaf renders it

* style: migrate violet to red in header..html

* style: migrate violet to red in payments.html

* style: update title color

* style: add icons

* fix(security): permit static resource paths in security configuration

* style: compact dialog keyframes and add stat-card gradient backgrounds

* style: redesign header with material icons and updated color scheme

* style: redesign stat cards with gradient backgrounds and hover effects

* style: remove hover transitions on stat cards and make filter fields responsive

* style: remove redundant sm:text-lg class from header icon

* style: restyle filter form with new colors, borders and backgrounds

---------

Co-authored-by: Mathieu-bot <mathieu-bot@users.noreply.github.com>
…sitory in test (#13)

* fix: mock PaymentService methods in PaymentViewControllerIT to return empty Page

* fix: add missing scope column to native query in JPaymentRepositoryCustomImpl

* fix: inject JPaymentFilterRepository instead of JPaymentRepository for filtering tests

---------

Co-authored-by: Mathieu-bot <mathieu-bot@users.noreply.github.com>
@TsioryJonathan TsioryJonathan changed the title feat: add scope filtering, OAuth2 with Casdoor, payment Web UI, and CSV export feat: scope notion, admin UI and csv export Jun 30, 2026
Comment thread src/main/java/school/hei/vola/endpoint/rest/controller/PaymentController.java Outdated
@SalomiaZK

Copy link
Copy Markdown
Collaborator

It's not a breaking change

Mathieu-bot and others added 5 commits July 2, 2026 14:59
* feat: update default end date to now

* refactor: change default end date to now() in PaymentViewController

* refactor(test): update date range in JPaymentRepositoryIT tests

* refactor(test): update payment date range to now()
@colombefioren colombefioren force-pushed the feat/admin-csv-scope branch from 268f339 to 41184c8 Compare July 2, 2026 15:52
colombefioren and others added 14 commits July 2, 2026 19:02
* feat: add error page template

* feat: add ErrorHandler for web error pages

* fix: use fully qualified Thymeleaf fragment syntax

* fix: error handling and pagination fragment syntax

---------

Co-authored-by: Mathieu-bot <mathieu-bot@users.noreply.github.com>
* fix: ErrorHandler status codes

* test: add ErrorHandlerTest

---------

Co-authored-by: Mathieu-bot <mathieu-bot@users.noreply.github.com>
…o filename (#41)

* fix: ErrorHandler status codes

* test: add ErrorHandlerTest

* fix: handle empty scope parameter in CSV export nullIfAll

* fix: append timestamp to CSV export filename to avoid collisions

---------

Co-authored-by: Mathieu-bot <mathieu-bot@users.noreply.github.com>
* fix: ErrorHandler status codes

* test: add ErrorHandlerTest

* fix: handle empty scope parameter in CSV export nullIfAll

* fix: append timestamp to CSV export filename to avoid collisions

* fix: update CSV export filename assertions to match new timestamped format

---------

Co-authored-by: Mathieu-bot <mathieu-bot@users.noreply.github.com>
colombefioren
colombefioren previously approved these changes Jul 7, 2026
@colombefioren colombefioren dismissed their stale review July 7, 2026 10:03

Approved by accident

@colombefioren colombefioren requested a review from hei-teacher July 9, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants