Backend

Stars
2

Budgeting Website Backend

This is the backend for the budgeting website. It should provide for the majority of processing and logic for the website. Users should be able to create secure accounts, store income and expense records, categorize those records into bucket, and budget their finances. Statistics should also be provided, such as net income over time.

Currently, several databases are intended to be supported. They include MySQL, PostgreSQL, MariaDB, SQLite, and H2. For testing, H2 is being used.

Technology

  • Java 17
  • Dropwizard
  • Jooq
  • SQLite JDBC
  • H2 JDBC
  • MySQL JDBC
  • PostgreSQL JDBC
  • MariaDB JDBC
  • Bouncycastle
  • JUnit
  • Jackson
  • Mybatis

Configuration

The project-specific configurations you can set in the YAML file you'll provide to the program.

  • database-url <String> - the url to the database.
  • admin-username <String> - the username of the admin account to be autogenerated.
  • admin-password <String> - the password of the admin account to be autogenerated.
  • max-username-length <Integer> - the maximum length to allow for usernames.

Setup

The schema for initializing the database can be found at src/main/resources/schema.sql.

Endpoints

Account

POST /account/{uuid}

Creates a new account with the provided username and password.

Consumes JSON

{
	username: String,
	password: String
}

AUTH:BasicDELETE /account/{username}

Delete an existing account based on the provided username. Will return 401 if the provided credentials does not correspond to an account with the admin role or is not the same account that is being deleted.

AUTH:BasicPUT /account/password

Update the password of authenticated account.

Consumes JSON

{
	password: String
}

AUTH:BasicPermited:ADMINPUT /account/{username}/roles

Update the roles of the account of the provided username. The roles should be comma-delimited. They are case-sensitive. The allowed roles are USER and ADMIN.

Consumes JSON

{
	roles: String
}

Account

AUTH:BasicPOST /bucket

Create a new bucket.

Consumes JSON

{
	name: String,
	share: Double
}

AUTH:BasicDELETE /bucket/{uuid}

Delete the bucket associated with the provided UUID.

AUTH:BasicPUT /bucket/{uuid}

Update the bucket associated with the provided UUID.

Consumes JSON

{
	name: String,
	share: Double
}

AUTH:BasicGET /bucket

Get the authenicated user's buckets.

Produces JSON

{
	[
		{
			uuid: String,
			created: LocalDateTime,
			updated: LocalDateTime,
			owner: String,
			name: String,
			share: Double,
			amount: Long
		},
		...
	]
}

Financial Record

AUTH:BasicPOST /record/income

Add an income record.

Consumes JSON

{
	amount: Integer,
	year: Integer,
	month: Integer,
	day: Integer,
	category: String,
	description: String
}

Produces TEXT

uuid: String

AUTH:BasicPOST /record/expense

Add an expense record.

Consumes JSON

{
	amount: Integer,
	year: Integer,
	month: Integer,
	day: Integer,
	category: String,
	description: String,
	bucket: String
}

Produces TEXT

uuid: String

AUTH:BasicDELETE /record/income/{uuid}

Delete an income record.

AUTH:BasicDELETE /record/expense/{uuid}

Delete an expense record.

AUTH:BasicGET /record/income

Get income records in the time range. Month and day values start at 1. So, January 1st, 2024, would be ...startYear=2024&startMonth=1&startDay=1...

Consumes PARAMS

startYear: String
startMonth: String
startDay: String
endYear: String
endMonth: String
endDay: String

AUTH:BasicGET /record/expense

Get expense records in the time range. Month and day values start at 1. So, January 1st, 2024, would be ...startYear=2024&startMonth=1&startDay=1...

Consumes PARAMS

startYear: String
startMonth: String
startDay: String
endYear: String
endMonth: String
endDay: String

AUTH:BasicPUT /record/income/{uuid}

Update an income record.

Consumes JSON

{
	amount: Integer,
	year: Integer,
	month: Integer,
	day: Integer,
	category: String,
	description: String
}

AUTH:BasicPUT /record/expense/{uuid}

Update an expense record.

Consumes JSON

{
	amount: Integer,
	year: Integer,
	month: Integer,
	day: Integer,
	category: String,
	description: String,
	bucket: String
}