mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-12 13:46:51 +00:00
split repo
This commit is contained in:
parent
542dbf0f97
commit
e02de4daa5
3 changed files with 56 additions and 58 deletions
32
README.md
32
README.md
|
|
@ -6,8 +6,9 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Rentease is a property-management application to help landlords to manage your rental properties efficiently. With
|
Rentease is a property-management application to help landlords to manage your rental
|
||||||
Rentease, you can create invoices, generate activity reports, and sync all the booking platforms you use.
|
properties efficiently. With Rentease, you can create invoices, generate activity
|
||||||
|
reports, and sync all the booking platforms you use.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
|
@ -15,7 +16,7 @@ Rentease, you can create invoices, generate activity reports, and sync all the b
|
||||||
- **Activity Reports**: Generate detailed reports of rental activities to keep track of your property performance.
|
- **Activity Reports**: Generate detailed reports of rental activities to keep track of your property performance.
|
||||||
- **Platform Sync**: Sync bookings across multiple platforms to streamline your rental management.
|
- **Platform Sync**: Sync bookings across multiple platforms to streamline your rental management.
|
||||||
|
|
||||||
[![RentEase Screen Shot][product-screenshot]](https://example.com)
|
[![RentEase Screenshot][product-screenshot]](https://example.com)
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
|
|
@ -23,10 +24,10 @@ To get started with Rentease, follow these steps.
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
You need a version of the Go programming language installed. You can either install it via your package manager or
|
You need a version of the Go programming language installed. You can either install
|
||||||
via [Go's official website](https://go.dev/).
|
it via your package manager or via [Go's official website](https://go.dev/).
|
||||||
You also need a PostgreSQL database. You can install it locally using Homebrew or use a cloud alternative such as
|
You also need a PostgreSQL database. You can install it locally using Homebrew or
|
||||||
Railway.
|
use a cloud alternative such as Railway, fly.io, _etc._.
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
|
|
@ -82,16 +83,17 @@ Rentease is built using the following technologies:
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
|
||||||
See the [open issues](https://github.com/users/rjNemo/projects/2/views/1) for a full list of proposed features (and
|
See the [open issues](https://github.com/users/rjNemo/projects/2/views/1) for a full
|
||||||
known issues).
|
list of proposed features (and known issues).
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any
|
Contributions are what make the open source community such an amazing place to learn,
|
||||||
contributions you make are **greatly appreciated**.
|
inspire, and create. Any contributions you make are **greatly appreciated**.
|
||||||
|
|
||||||
|
If you have a suggestion that would make this better, please fork the repo and create
|
||||||
|
a pull request. You can also simply open an issue with the tag "enhancement".
|
||||||
|
|
||||||
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also
|
|
||||||
simply open an issue with the tag "enhancement".
|
|
||||||
Don't forget to give the project a star! Thanks again!
|
Don't forget to give the project a star! Thanks again!
|
||||||
|
|
||||||
1. Fork the Project
|
1. Fork the Project
|
||||||
|
|
@ -103,7 +105,3 @@ Don't forget to give the project a star! Thanks again!
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Distributed under the MIT License. See `LICENSE.md` for more information.
|
Distributed under the MIT License. See `LICENSE.md` for more information.
|
||||||
|
|
||||||
## TODO
|
|
||||||
|
|
||||||
- [ ] other dates are not stored/parsed properly
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/clause"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type PgStore struct {
|
type PgStore struct {
|
||||||
|
|
@ -101,43 +100,3 @@ func (ps *PgStore) Cancel(id int) error {
|
||||||
Update("canceled", true).
|
Update("canceled", true).
|
||||||
Error
|
Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// items
|
|
||||||
|
|
||||||
func (ps *PgStore) CreateItem(i *Item) error {
|
|
||||||
return ps.db.Create(i).Error
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ps *PgStore) PayItem(id int) (*Item, error) {
|
|
||||||
i := new(Item)
|
|
||||||
if err := ps.db.Model(i).
|
|
||||||
Clauses(clause.Returning{}).
|
|
||||||
Where("id = ?", id).
|
|
||||||
Update("payment_status", "Completed").
|
|
||||||
Error; err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ps *PgStore) GetItem(id int) (*Item, error) {
|
|
||||||
i := &Item{Id: id}
|
|
||||||
err := ps.db.First(i).Error
|
|
||||||
return i, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ps *PgStore) UpdateItem(id int, item string, paymentMethod string, paymentStatus string, qty int, price float64) (*Item, error) {
|
|
||||||
i := new(Item)
|
|
||||||
err := ps.db.Model(i).
|
|
||||||
Clauses(clause.Returning{}).
|
|
||||||
Where("id = ?", id).
|
|
||||||
Updates(map[string]any{
|
|
||||||
"item": item,
|
|
||||||
"payment_method": paymentMethod,
|
|
||||||
"payment_status": paymentStatus,
|
|
||||||
"quantity": qty,
|
|
||||||
"price": price,
|
|
||||||
}).
|
|
||||||
Error
|
|
||||||
return i, err
|
|
||||||
}
|
|
||||||
41
internal/booking/item_store.go
Normal file
41
internal/booking/item_store.go
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
package booking
|
||||||
|
|
||||||
|
import "gorm.io/gorm/clause"
|
||||||
|
|
||||||
|
func (ps *PgStore) CreateItem(i *Item) error {
|
||||||
|
return ps.db.Create(i).Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ps *PgStore) PayItem(id int) (*Item, error) {
|
||||||
|
i := new(Item)
|
||||||
|
if err := ps.db.Model(i).
|
||||||
|
Clauses(clause.Returning{}).
|
||||||
|
Where("id = ?", id).
|
||||||
|
Update("payment_status", "Completed").
|
||||||
|
Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ps *PgStore) GetItem(id int) (*Item, error) {
|
||||||
|
i := &Item{Id: id}
|
||||||
|
err := ps.db.First(i).Error
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ps *PgStore) UpdateItem(id int, item string, paymentMethod string, paymentStatus string, qty int, price float64) (*Item, error) {
|
||||||
|
i := new(Item)
|
||||||
|
err := ps.db.Model(i).
|
||||||
|
Clauses(clause.Returning{}).
|
||||||
|
Where("id = ?", id).
|
||||||
|
Updates(map[string]any{
|
||||||
|
"item": item,
|
||||||
|
"payment_method": paymentMethod,
|
||||||
|
"payment_status": paymentStatus,
|
||||||
|
"quantity": qty,
|
||||||
|
"price": price,
|
||||||
|
}).
|
||||||
|
Error
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue