mirror of
https://github.com/spliit-app/spliit.git
synced 2025-12-06 01:19:29 +01:00
README
This commit is contained in:
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License Copyright (c) 2023 Sebastien Castiel
|
||||||
|
|
||||||
|
Permission is hereby granted,
|
||||||
|
free of charge, to any person obtaining a copy of this software and associated
|
||||||
|
documentation files (the "Software"), to deal in the Software without
|
||||||
|
restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice
|
||||||
|
(including the next paragraph) shall be included in all copies or substantial
|
||||||
|
portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||||
|
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
||||||
|
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
45
README.md
45
README.md
@@ -1,36 +1,31 @@
|
|||||||
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).
|
# [Spliit](https://spliit.app)
|
||||||
|
|
||||||
## Getting Started
|
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.
|
||||||
|
|
||||||
First, run the development server:
|
## Features
|
||||||
|
|
||||||
```bash
|
- [x] Create a group and share it with friends
|
||||||
npm run dev
|
- [x] Create expenses with description
|
||||||
# or
|
- [x] Display group balances
|
||||||
yarn dev
|
- [x] Create reimbursement expenses
|
||||||
# or
|
- [x] Progressive Web App
|
||||||
pnpm dev
|
|
||||||
# or
|
|
||||||
bun dev
|
|
||||||
```
|
|
||||||
|
|
||||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
### Work in progress
|
||||||
|
|
||||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
- [ ] Select all/no participant for expenses
|
||||||
|
- [ ] Tell the application who you are when opening a group
|
||||||
|
|
||||||
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
|
## Stack
|
||||||
|
|
||||||
## Learn More
|
- [Next.js](https://nextjs.org/) for the web application
|
||||||
|
- [TailwindCSS](https://tailwindcss.com/) for the styling
|
||||||
|
- [shadcn/UI](https://ui.shadcn.com/) for the UI components
|
||||||
|
- [Vercel](https://vercel.com/) for hosting (application and database)
|
||||||
|
|
||||||
To learn more about Next.js, take a look at the following resources:
|
## Contribute
|
||||||
|
|
||||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
The project is open to contributions. Feel free to open an issue or even a pull-request!
|
||||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
||||||
|
|
||||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
## License
|
||||||
|
|
||||||
## Deploy on Vercel
|
MIT, see [LICENSE](./LICENSE).
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
|
||||||
|
|||||||
@@ -33,16 +33,6 @@ export default function HomePage() {
|
|||||||
Create a group
|
Create a group
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
<Button asChild variant="secondary" size="lg">
|
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
href="https://github.com/scastiel/spliit2"
|
|
||||||
>
|
|
||||||
<Github className="w-4 h-4 mr-2" />
|
|
||||||
GitHub
|
|
||||||
</a>
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ async function main() {
|
|||||||
withClient(async (client) => {
|
withClient(async (client) => {
|
||||||
const prisma = await getPrisma()
|
const prisma = await getPrisma()
|
||||||
|
|
||||||
|
// console.log('Deleting all groups…')
|
||||||
|
// await prisma.group.deleteMany({})
|
||||||
|
|
||||||
const { rows: groupRows } = await client.query<{
|
const { rows: groupRows } = await client.query<{
|
||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
@@ -17,6 +20,10 @@ async function main() {
|
|||||||
created_at: Date
|
created_at: Date
|
||||||
}>('select id, name, currency, created_at from groups')
|
}>('select id, name, currency, created_at from groups')
|
||||||
|
|
||||||
|
const existingGroups = (
|
||||||
|
await prisma.group.findMany({ select: { id: true } })
|
||||||
|
).map((group) => group.id)
|
||||||
|
|
||||||
for (const groupRow of groupRows) {
|
for (const groupRow of groupRows) {
|
||||||
const participants: Prisma.ParticipantCreateManyInput[] = []
|
const participants: Prisma.ParticipantCreateManyInput[] = []
|
||||||
const expenses: Prisma.ExpenseCreateManyInput[] = []
|
const expenses: Prisma.ExpenseCreateManyInput[] = []
|
||||||
@@ -24,10 +31,7 @@ async function main() {
|
|||||||
const participantIdsMapping: Record<number, string> = {}
|
const participantIdsMapping: Record<number, string> = {}
|
||||||
const expenseIdsMapping: Record<number, string> = {}
|
const expenseIdsMapping: Record<number, string> = {}
|
||||||
|
|
||||||
const existingGroup = await prisma.group.findUnique({
|
if (existingGroups.includes(groupRow.id)) {
|
||||||
where: { id: groupRow.id },
|
|
||||||
})
|
|
||||||
if (existingGroup) {
|
|
||||||
console.log(`Group ${groupRow.id} already exists, skipping.`)
|
console.log(`Group ${groupRow.id} already exists, skipping.`)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -65,7 +69,7 @@ async function main() {
|
|||||||
paid_by_participant_id: number
|
paid_by_participant_id: number
|
||||||
is_reimbursement: boolean
|
is_reimbursement: boolean
|
||||||
}>(
|
}>(
|
||||||
'select id, created_at, description, amount, paid_by_participant_id, is_reimbursement from expenses where group_id = $1::text',
|
'select id, created_at, description, amount, paid_by_participant_id, is_reimbursement from expenses where group_id = $1::text and deleted_at is null',
|
||||||
[groupRow.id],
|
[groupRow.id],
|
||||||
)
|
)
|
||||||
for (const expenseRow of expenseRows) {
|
for (const expenseRow of expenseRows) {
|
||||||
|
|||||||
Reference in New Issue
Block a user