Skip to content

Latest commit

 

History

History
351 lines (276 loc) · 4.78 KB

README.md

File metadata and controls

351 lines (276 loc) · 4.78 KB

hedgeapp backend 🦔

Backend of an application created to streamline and enhance the inventory processes for individuals and teams managing green areas.

tech stack 🔧

Go Gin Postgresql Docker

dev quickstart 🚧

$ docker compose up --build -d

project structure 🌳

.
├── Dockerfile
├── README.md
├── controllers
│   ├── investorsController.go
│   ├── locationsController.go
│   ├── officeController.go
│   ├── statusesController.go
│   └── usersController.go
├── docker-compose.yaml
├── go.mod
├── go.sum
├── initializers
│   ├── dbConnector.go
│   ├── dbSeeder.go
│   ├── dbSynchronizer.go
│   ├── envVariablesLoader.go
│   └── seeds
│       ├── offices.json
│       └── statuses.json
├── main.go
├── middleware
│   ├── handleCORS.go
│   └── requireAuth.go
├── models
│   ├── addressModel.go
│   ├── applicationModel.go
│   ├── authModel.go
│   ├── commonModel.go
│   ├── investorModel.go
│   ├── locationModel.go
│   ├── noteModel.go
│   ├── officeModel.go
│   ├── statusModel.go
│   └── userModel.go
├── test
├── tmp
└── validators
    └── usersValidator.go

api endpoints 📖

Auth

register

POST /register
{
  email: string,
  password: string
}

login

POST /login
{
  email: string,
  password: string
}

validate

GET /validate

delete user

DELETE /users
Statuses

get statuses

GET /statuses

create status

POST /statuses
{
  name: string;
}

update status

PUT /statuses/:id
{
  name: string;
}

delete status

DELETE /statuses/:id
Investor

get investors

GET /investors

get single investor

GET /investors/:id

create investor

POST /investors
{
  name: string,
  contactPerson: string,
  phone: string,
  email: string,
  nip: string,
  regon: string,
  address: {
    city: string,
    street: string,
    number: string,
    zipCode: string
  }
}

update investor

PUT /investors/:id
{
  name: string,
  contactPerson: string,
  phone: string,
  email: string,
  nip: string,
  regon: string,
  address: {
    city: string,
    street: string,
    number: string,
    zipCode: string
  }
}

delete investor

DELETE /investors/:id
Offices

get offices

GET /offices

get single office

GET /offices/:id

create office

POST /offices
{
  name: string,
    address: {
    city: string,
    street: string,
    number: string,
    zipCode: string
  }
}

update office

PUT /offices/:id
{
  name: string,
  address: {
    city: string,
    street: string,
    number: string,
    zipCode: string
  }
}

delete office

DELETE /offices/:id
Locations

get locations

GET /locations

get single location

GET /locations/:id

create location

POST /locations
{
  name: string,
  issueDate: string, // ISO 8601
  inspectionDate: string, // ISO 8601
  deforestationDate: string, // ISO 8601
  plantingDate: string, // ISO 8601
  deforestationDone: boolean,
  plantingDone: boolean,
  address: {
    city: string,
    street: string,
    number: string,
    zipCode: string
  },
  statusId: int,
  investorId: int,
}

update location

PUT /locations/:id
{
  name: string,
  issueDate: string, // ISO 8601
  inspectionDate: string, // ISO 8601
  deforestationDate: string, // ISO 8601
  plantingDate: string, // ISO 8601
  deforestationDone: boolean,
  plantingDone: boolean,
  address: {
    city: string,
    street: string,
    number: string,
    zipCode: string
  },
  statusId: int,
  investorId: int,
}

delete location

DELETE /locations/:id