-
Creating Expenses
- Any user can log an expense, only a single user can log an expense
- The expense can be shared between multiple users
- The expense can be shared using percentage weights
- Subset of group users can be invloved in an expense
-
Group summary -> who owes how much to whom?
-
User summary -> How much the user has paid to whom
-
Settling of expenses can be done in a group level
-
Edit expenses is allowed
-
Minimize payment transactions is optional -> optimising this
-
Commenting on an expense
-
Creating users
-
Creating Groups
Extensible -> multiple users log an expense
Groups and users are created -> userid1 and userid2, groupid1 Create a mock in-memory database Map<expenseId, Expense>
Users Groups User many to many Groups userGroupRelationShip <userId, GroupId>
- Creating Expenses
- Any user can log an expense, only a single user can log an expense
- The expense can be shared between multiple users
- The expense can be shared using percentage weights
- Subset of group users can be invloved in an expense
- Group summary -> who owes how much to whom?
- User summary -> How much the user has paid to whom
HTTPMETHOD ROUTE REQ RESPONSE
//creating an expense
POST '/expense' {
groupId: string;
payers: [
{
userId: string;
amount: number;
}
],
payees: [
{
userId: string;
percentage?: number;
}
],
} {
expenseId: string,
}
//user summary ->
GET '/user/:userid/summary' {}{
userid: string;
summary: {
// haveRecievedFrom?: [{
// userId: string;
// amount: number;
// }]
// haveOwedTo?: [{
// userId: string;
// amount: number;
// }]
totalAmountOwed: number;
totalAmountRecieved: number;
}
}
Amount {
amount: number;
}
User {
userId: string;
}
Group {
groupId: string;
expenses: Array<Expense>;
// balance: Balance;
}
Expense {
expenseId: string;
payers: Array<{
userId: string;
amount: Amount;
}>;
payees: Array<{
userId: string;
amonut: Amount;
percentage?: number;
}>
}
Balance {
userId: Array<{
userId: string;
amount: Amount;
}>
}
GroupVsUserRelationship {
groupId: string;
userId: string;
}
npm init -y
npm i express dotenv typescript @tsconfig/node18 compression body-parser cors module-alias tstl
npm i -D typescript @types/express @types/node @types/compression @types/cors concurrently nodemon
npx tsc --init