Skip to content

Repository files navigation

Advocate Registration — digit_assignment

Backend microservice for the DIGIT Developer Certification (Level 1) assignment. Implements an Advocate Registration registry on the DIGIT 2.9-LTS platform, integrating with IDGen, MDMS v2, Persister (Kafka), and Workflow. Indexer config is included as the bonus.

  • Module: digit_assignment
  • Base package: digit.academy.tutorial
  • API base path: /digit_assignment/advocate/v1/{_create,_update,_search}

API

Method Path Description
POST /advocate/v1/_create Register a new advocate (validate → enrich → workflow → persist)
POST /advocate/v1/_update Update / transition an advocate application
POST /advocate/v1/_search Search advocates by id / applicationNumber / barRegistrationNumber

All requests are wrapped in RequestInfo; all responses in ResponseInfo (egov common contract).

Architecture

Controller → Service → Validator (MDMS code check)
                     → Enrichment (IDGen application number, audit, UUIDs)
                     → WorkflowUtil (ADVOCATE_REGISTRATION business service)
                     → Producer (Kafka) → Persister → PostgreSQL
           Search → Repository (JdbcTemplate + ResultSetExtractor)

Project Layout

Path Purpose
src/main/java/digit/academy/tutorial/ Service source code
src/main/resources/db/migration/main/ Flyway DDL (eg_advocate, eg_advocate_document)
build/digit_assignment.jar Built executable artifact (for evaluation)
workflow/workflow_config.json Workflow business service config
masters/ MDMS master data — AdvocateType, UserType, IdFormat
persister/persister_config.yaml Kafka topic → SQL mappings
indexer/indexer_config.yaml Kafka topic → Elasticsearch index (bonus)
api_test/postman_collection.json Create / update / search requests

Master Data (MDMS v2)

Module DIGIT-ASSIGNMENT:

  • AdvocateType: PROSECUTOR, PUBLIC_DEFENDER, ADVOCATE_GENERAL, STANDING_COUNSEL
  • UserType: ADVOCATE, ADVOCATE_CLERK

ID formats (common-masters.IdFormat):

  • Advocate: ADVOC_[SEQ_EG_ADVOCATE]_[cy:yyyy]
  • Advocate Clerk: ADVOC_CLERK_[SEQ_EG_ADVOCATE_CLERK]_[cy:yyyy]

Workflow — ADVOCATE_REGISTRATION

(start) --APPLY [CITIZEN, ADVOCATE]--> PENDINGVERIFICATION
PENDINGVERIFICATION --APPROVE [NYAY_MITRA]--> APPROVED (terminal)
PENDINGVERIFICATION --REJECT  [NYAY_MITRA]--> REJECTED (terminal)

Build

export JAVA_HOME=/opt/homebrew/opt/openjdk@17
mvn clean package -DskipTests
cp target/digit_assignment.jar build/digit_assignment.jar

Run locally

Requires PostgreSQL (localhost:5432, db postgres) and Kafka (localhost:9092) running. Port-forward the DIGIT services before exercising create/update:

kubectl port-forward svc/egov-mdms-service-v2 8094:8080 -n egov &
kubectl port-forward svc/egov-idgen 8285:8080 -n egov &
kubectl port-forward svc/egov-workflow-v2 8280:8080 -n egov &
kubectl port-forward svc/egov-user 8284:8080 -n egov &

java -jar build/digit_assignment.jar

The service starts on port 8080 with context path /digit_assignment and runs the Flyway migration on startup.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages