Skip to content

Commit

Permalink
Merge pull request #135 from GenieWizards/feat/create-split-settlements
Browse files Browse the repository at this point in the history
Feat/create expense with split and settlements
  • Loading branch information
shivamvijaywargi authored Feb 3, 2025
2 parents 3aecae8 + 1c7bb1d commit 545ad66
Show file tree
Hide file tree
Showing 18 changed files with 2,751 additions and 192 deletions.
3 changes: 3 additions & 0 deletions src/common/utils/app.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type MakeNonNullable<T, K extends keyof T> = {
[P in K]: NonNullable<T[P]>;
};
6 changes: 6 additions & 0 deletions src/common/utils/test.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,9 @@ export async function createTestUser({

return { ...result.user, session: result.session.id };
}

export function createRandomEmail() {
const domain = "gmail.com";
const randomId = Bun.randomUUIDv7();
return `user${randomId}@${domain}`;
}
11 changes: 11 additions & 0 deletions src/db/migrations/0002_safe_cobalt_man.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE "settlement" (
"id" varchar(60) PRIMARY KEY NOT NULL,
"sender_id" varchar(60) NOT NULL,
"receiver_id" varchar(60) NOT NULL,
"group_id" varchar(60),
"amount" real NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "split" DROP COLUMN "is_settled";
1 change: 1 addition & 0 deletions src/db/migrations/0003_bored_captain_stacy.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "expense" ALTER COLUMN "split_type" DROP NOT NULL;
Loading

0 comments on commit 545ad66

Please sign in to comment.