Skip to content

Commit 9f7ea9c

Browse files
committed
README
1 parent 69fa008 commit 9f7ea9c

File tree

4 files changed

+50
-40
lines changed

4 files changed

+50
-40
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License Copyright (c) 2023 Sebastien Castiel
2+
3+
Permission is hereby granted,
4+
free of charge, to any person obtaining a copy of this software and associated
5+
documentation files (the "Software"), to deal in the Software without
6+
restriction, including without limitation the rights to use, copy, modify, merge,
7+
publish, distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to the
9+
following conditions:
10+
11+
The above copyright notice and this permission notice
12+
(including the next paragraph) shall be included in all copies or substantial
13+
portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
16+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
18+
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,31 @@
1-
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
1+
# [Spliit](https://spliit.app)
22

3-
## Getting Started
3+
Spliit is a free and open source alternative to Splitwise. I created it back in 2022 as a side project to learn the Go language, but rewrote it with Next.js since.
44

5-
First, run the development server:
5+
## Features
66

7-
```bash
8-
npm run dev
9-
# or
10-
yarn dev
11-
# or
12-
pnpm dev
13-
# or
14-
bun dev
15-
```
7+
- [x] Create a group and share it with friends
8+
- [x] Create expenses with description
9+
- [x] Display group balances
10+
- [x] Create reimbursement expenses
11+
- [x] Progressive Web App
1612

17-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
13+
### Work in progress
1814

19-
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
15+
- [ ] Select all/no participant for expenses
16+
- [ ] Tell the application who you are when opening a group
2017

21-
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
18+
## Stack
2219

23-
## Learn More
20+
- [Next.js](https://nextjs.org/) for the web application
21+
- [TailwindCSS](https://tailwindcss.com/) for the styling
22+
- [shadcn/UI](https://ui.shadcn.com/) for the UI components
23+
- [Vercel](https://vercel.com/) for hosting (application and database)
2424

25-
To learn more about Next.js, take a look at the following resources:
25+
## Contribute
2626

27-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27+
The project is open to contributions. Feel free to open an issue or even a pull-request!
2928

30-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29+
## License
3130

32-
## Deploy on Vercel
33-
34-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35-
36-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
31+
MIT, see [LICENSE](./LICENSE).

src/app/page.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@ export default function HomePage() {
3333
Create a group
3434
</Link>
3535
</Button>
36-
<Button asChild variant="secondary" size="lg">
37-
<a
38-
target="_blank"
39-
rel="noreferrer"
40-
href="https://github.com/scastiel/spliit2"
41-
>
42-
<Github className="w-4 h-4 mr-2" />
43-
GitHub
44-
</a>
45-
</Button>
4636
</div>
4737
</div>
4838
</section>

src/scripts/migrate.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,28 @@ async function main() {
1010
withClient(async (client) => {
1111
const prisma = await getPrisma()
1212

13+
// console.log('Deleting all groups…')
14+
// await prisma.group.deleteMany({})
15+
1316
const { rows: groupRows } = await client.query<{
1417
id: string
1518
name: string
1619
currency: string
1720
created_at: Date
1821
}>('select id, name, currency, created_at from groups')
1922

23+
const existingGroups = (
24+
await prisma.group.findMany({ select: { id: true } })
25+
).map((group) => group.id)
26+
2027
for (const groupRow of groupRows) {
2128
const participants: Prisma.ParticipantCreateManyInput[] = []
2229
const expenses: Prisma.ExpenseCreateManyInput[] = []
2330
const expenseParticipants: Prisma.ExpensePaidForCreateManyInput[] = []
2431
const participantIdsMapping: Record<number, string> = {}
2532
const expenseIdsMapping: Record<number, string> = {}
2633

27-
const existingGroup = await prisma.group.findUnique({
28-
where: { id: groupRow.id },
29-
})
30-
if (existingGroup) {
34+
if (existingGroups.includes(groupRow.id)) {
3135
console.log(`Group ${groupRow.id} already exists, skipping.`)
3236
continue
3337
}
@@ -65,7 +69,7 @@ async function main() {
6569
paid_by_participant_id: number
6670
is_reimbursement: boolean
6771
}>(
68-
'select id, created_at, description, amount, paid_by_participant_id, is_reimbursement from expenses where group_id = $1::text',
72+
'select id, created_at, description, amount, paid_by_participant_id, is_reimbursement from expenses where group_id = $1::text and deleted_at is null',
6973
[groupRow.id],
7074
)
7175
for (const expenseRow of expenseRows) {

0 commit comments

Comments
 (0)