Skip to content

Ya-Red7/immigration-case-api

Repository files navigation

Fairground & Associates: Immigration Filing Date API

A specialized backend utility for immigration law firms to standardize the calculation of "Estimated Filing Dates" based on Priority Date backlogs for specific nationalities and visa categories.

Business Logic (The 1095-Day Rule)

The API applies a "Backlogged" status and a 1095-day (3-year) buffer if:

  • Country of Origin: India OR China
  • Visa Category: EB2 OR EB3

For all other combinations, the status is set to "Current" with a 0-day buffer.


API Specification

Calculate Filing Window

Determines the estimated date a client can file their application.

  • URL: /api/v1/calculate-filing
  • Method: POST
  • Content-Type: application/json

Request Body

Field Type Description
country_of_origin String The applicant's nationality (e.g., "India").
visa_category String The visa type (e.g., "EB2", "EB3", "EB1").
priority_date String ISO-8601 format (YYYY-MM-DD).

Sample Request (Backlogged)

{
    "country_of_origin": "India",
    "visa_category": "EB2",
    "priority_date": "2024-05-20"
}

Sample Response

{
    "status": "Backlogged",
    "buffer_days": 1095,
    "priority_date": "2024-05-20",
    "estimated_filing_date": "2027-05-20"
}

Setup & Running Build: ./gradlew build

Run: ./gradlew run

Test: Use Postman or cURL to hit http://localhost:8080/api/v1/calculate-filing


2. Dockerfile

This uses a Multi-Stage Build. It compiles the code in a heavy "Gradle" environment but runs the final app in a tiny "Alpine" environment to ensure it stays within the 512MB RAM limit of free hosting tiers.

# STAGE 1: Build the Application
FROM gradle:8.5-jdk17 AS build
WORKDIR /home/gradle/src
# Copy project files
COPY --chown=gradle:gradle . .
# Generate the Fat JAR
RUN gradle buildFatJar --no-daemon

# STAGE 2: Runtime Environment
FROM eclipse-temurin:17-jre-alpine
EXPOSE 8080
WORKDIR /app

# Copy the JAR from the build stage
# Note: Ensure the wildcard matches your project name (usually *-all.jar)
COPY --from=build /home/gradle/src/build/libs/*-all.jar /app/fairground-api.jar

# Run with Memory Constraints (Optimized for Render Free Tier)
ENTRYPOINT ["java", "-Xmx300m", "-Xms128m", "-jar", "/app/fairground-api.jar"]

Final Deployment Steps

Push to GitHub: Ensure these two files are in your root directory.

Connect to Render: Choose Docker as the environment.

Set Environment Variable: Add PORT = 8080 in the Render dashboard.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors