After launching the app, you can log as one of the demo users:
Elena@example.com
password
3
in the textfield. Click the button and you will gain access to the group "Souflé"
Mateo@example.com
password
Kotlin code that allows to post data into the backend
get Groups
LaunchedEffect(Unit) {
RestClient.instance.getGroups(object : GroupsCallback {
override fun onSuccess(groups: List<Group>) {
receivedGroups = groups
Log.d("RestClient", "GET groups success $receivedGroups")
}
override fun onFailure(error: String) {
Log.d("RestClient", "GET groups error $error")
}
})
}
get Users
LaunchedEffect(Unit) {
RestClient.instance.getUsers(object : UsersCallback {
override fun onSuccess(users: List<User>) {
receivedUsers = users
Log.d("RestClient", "GET users success $receivedUsers")
}
override fun onFailure(error: String) {
Log.d("RestClient", "GET users error $error")
}
}, selectedGroup!!.id)
}
get expenses
LaunchedEffect(Unit) {
RestClient.instance.getExpenses(object : ExpensesCallback {
override fun onSuccess(expenses: List<Expense>) {
receivedExpenses = expenses
Log.d("RestClient", "GET expenses success $receivedExpenses")
}
override fun onFailure(error: String) {
Log.d("RestClient", "GET expenses error $error")
}
}, selectedGroup!!.id)
}
get debts
LaunchedEffect(Unit) {
RestClient.instance.getDebts(object : DebtsCallback {
override fun onSuccess(debts: List<Debt>) {
receivedDebts = debts
Log.d("RestClient", "GET debts success $receivedDebts")
}
override fun onFailure(error: String) {
Log.d("RestClient", "GET debts error $error")
}
}, group!!.id)
}
LaunchedEffect(Unit) {
RestClient.instance.createGroups(listOf("1", "2"), "TestGroup", "EUR", "description" )
}
-> description is optional
LaunchedEffect(Unit) {
RestClient.instance.deleteGroup("4")
}
LaunchedEffect(Unit) {
RestClient.instance.addUsersToGroup("4", listOf("2", "4"))
}
LaunchedEffect(Unit) {
RestClient.instance.removeUsersFromGroup("0", listOf("2", "4"))
}
LaunchedEffect(Unit) {
RestClient.instance.addExpense("0","1", listOf("1","2"),25.2, "2023-11-18T21:16:26.567Z", "for beers")
}
-> description is optional
To run backend move to the backend
directory and run
npm run start
This will run a server listening on localhost:3000
One group with four users is hardcoded.
Backend exposes methods (example body provided for post methods):
http://localhost:3000/groups/{groupId}/expenses
{
"payerId": "1",
"participantsIds": ["1", "2", "3", "4"],
"amount": 100,
"date": "2023-11-18T21:16:26.567Z",
"description": "For beers"
}
http://localhost:3000/groups/{groupId}/expenses
http://localhost:3000/groups/{groupId}/debts
Debts are calculated automatically based on expenses, thus no POST debts method is possible.
http://localhost:3000/groups
http://localhost:3000/groups
{
"userIds": ["1", "3"],
"name": "group 1",
"description": "test group"
"currency": "EUR"
}
http://localhost:3000/groups/{groupId}
http://localhost:3000/groups/{groupId}
-> modify group (right now only by adding users)http://localhost:3000/groups/{groupId}/users
{ "userIds": [1, 4] }