bhms

module
v0.0.0-...-c2300e3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2023 License: Apache-2.0

README

bhms

Boarding house management system developed with Go, Flutter, Postgres, and Kubernetes.

Minimum Viable Product (MVP)

Development Plan
  • Define features for the MVP and design the database
  • Design and develop APIs for the mobile application ←
  • Design and develop Android, iOS applications
Features for Landlords
  • Create boarding areas and manage room lists
  • Create contracts for tenants
  • Manage utilities such as electricity, water, and other services
  • Manage payment information (bank accounts)
  • Create and share invoices for each room.
Database Design
Table users

The users table stores essential information about users.

Column Name Data Type Required Description
id uuid Primary key
first_name text First name
last_name text Last name
phone text Used for login, unique
password_hash text Encrypted password
roles text[] Roles: USER, ADMIN
status text User status: CREATED, ACTIVE, DELETED
created_at timestamp Creation timestamp
updated_at timestamp Update timestamp
Table divisions

The divisions table stores information about administrative divisions in Vietnam.

Column Name Data Type Required Description
id serial Primary key, auto-increment
name text Name of the administrative division
code integer Administrative division code
level smallint Level of administrative division - 1: Province, 2: District, 3: Ward
parent_id serial ID of the higher-level division
created_at timestamp Creation timestamp
updated_at timestamp Update timestamp
Table properties

The properties table stores essential information about boarding areas.

Column Name Data Type Required Description
id uuid Primary key
name text Boarding area name
address_level_1_id serial ID of province
address_level_2_id serial ID of district
address_level_3_id serial ID of ward
street text House number and street name
manager_id uuid ID of the landlord
status text Boarding area status: CREATED, ACTIVE, DELETED
created_at timestamp Creation timestamp
updated_at timestamp Update timestamp
Table blocks

The blocks table stores information about the blocks within the boarding area.

Column Name Data Type Required Description
id uuid Primary key
name text Block name
property_id uuid ID of the boarding area
status text Block status: ACTIVE, DELETED
created_at timestamp Creation timestamp
updated_at timestamp Update timestamp
Table floors

The floors table stores information about the floors within the boarding area.

Column Name Data Type Required Description
id uuid Primary key
name text Floor name
block_id uuid ID of the block
property_id uuid ID of the boarding area
status text Floor status: ACTIVE, DELETED
created_at timestamp Creation timestamp
updated_at timestamp Update timestamp
Table units

The units table stores information about the rooms within the boarding area.

Column Name Data Type Required Description
id uuid Primary key
name text Room name
property_id uuid ID of the boarding area
block_id uuid ID of the block
floor_id uuid ID of the floor
status text Room status: ACTIVE, DELETED
created_at timestamp Creation timestamp
updated_at timestamp Update timestamp
Table payment_methods

The payment_methods table stores payment information (bank accounts) of landlords.

Column Name Data Type Required Description
id bigserial Primary key
name text Bank name
account_name text Account holder's name
account_number text Account number
note text Note
enabled boolean Enable/disable status of the payment method
property_id uuid ID of the boarding area
status text Status: ACTIVE, DELETED
created_at timestamp Creation timestamp
updated_at timestamp Update timestamp
Table sessions

The sessions table stores information about room rentals over time in contracts.

Column Name Data Type Required Description
id uuid Primary key
unit_id uuid ID of the room
start_at timestamp Start time of occupancy
duration_in_days smallint Contract duration in days
rental_fee bigint Rental fee (VND)
num_of_members smallint Number of members
renew_times smallint Number of contract renewals
note text Note
status text Status: ACTIVE, ENDED, DELETED
created_at timestamp Creation timestamp
updated_at timestamp Update timestamp
Table services

The services table stores information about the services provided in the boarding area.

Column Name Data Type Required Description
id uuid Primary key
property_id uuid ID of the boarding area
name text Service name
service_fee bigint Service fee (VND)
unit text Unit: kwh, m3, room, member, piece, time
invoice_type text Billing unit: PER_USAGE, PER_ROOM, PER_MEMBER, PER_PIECE, PER_TIME
status text Status: ACTIVE, DELETED
enabled boolean Enable/disable status of the service
created_at timestamp Creation timestamp
updated_at timestamp Update timestamp
Table session_services

The session_services table stores information about the services registered for each session.

Column Name Data Type Required Description
id bigserial ID of the session-service
session_id uuid ID of the session
service_id uuid ID of the service
status text Status: ACTIVE, DELETED
created_at timestamp Creation timestamp
updated_at timestamp Update timestamp
Table session_invoices

The session_invoices table stores information about invoices for each session.

Column Name Data Type Required Description
id uuid Primary key
session_id uuid ID of the session
start_at timestamp Start time for calculating charges
rental_fee bigint Rental fee (VND)
additional_fee bigint Additional charges (VND)
discount bigint Discount (VND)
additional_fee_reason text Reason for additional charges
discount_reason text Reason for discount
note text Note
status text Status: ACTIVE, PAID, DELETED
created_at timestamp Creation timestamp
updated_at timestamp Update timestamp
Table session_service_invoices

The session_service_invoices table stores information about service invoices for each session.

Column Name Data Type Required Description
id uuid Primary key
invoice_id uuid ID of the invoice
session_service_id bigserial ID of the session-service
service_name text Service name
service_unit text Unit: kwh, m3, room, member, piece, time
service_invoice_type text Billing unit: PER_USAGE, PER_ROOM, PER_MEMBER, PER_PIECE, PER_TIME
service_fee bigint Service fee (VND)
latest_index integer Previous recorded index
current_index integer Current recorded index
quantity integer Quantity
note integer Note
total bigint Total amount (VND)
status text Status: ACTIVE, DELETED
created_at timestamp Creation timestamp
updated_at timestamp Update timestamp

Directories

Path Synopsis
app
services/api/v1
Package v1 manages the different versions of the API.
Package v1 manages the different versions of the API.
services/api/v1/handlers/checkgrp
Package checkgrp maintains the group of handlers for health checking.
Package checkgrp maintains the group of handlers for health checking.
services/api/v1/handlers/divisiongrp
Package divisiongrp ...
Package divisiongrp ...
services/api/v1/handlers/usergrp
Package usergrp maintains the group of handlers for user access.
Package usergrp maintains the group of handlers for user access.
services/api/v1/paging
Package paging provides support for query paging.
Package paging provides support for query paging.
services/metrics/collector
Package collector is a simple collector for
Package collector is a simple collector for
services/metrics/publisher
Package publisher manages the publishing of metrics.
Package publisher manages the publishing of metrics.
services/metrics/publisher/datadog
Package datadog provides support for publishing metrics to DD.
Package datadog provides support for publishing metrics to DD.
services/metrics/publisher/expvar
Package expvar manages the publishing of metrics to stdout.
Package expvar manages the publishing of metrics to stdout.
services/metrics/publisher/prometheus
Package prometheus provides suppoert for sending metrics to prometheus.
Package prometheus provides suppoert for sending metrics to prometheus.
tooling/admin
This program performs administrative tasks for the garage sale service.
This program performs administrative tasks for the garage sale service.
tooling/admin/commands
Package commands contains the functionality for the set of commands currently supported by the CLI tooling.
Package commands contains the functionality for the set of commands currently supported by the CLI tooling.
tooling/docs/output/html
Package html converts the webapi records into html.
Package html converts the webapi records into html.
tooling/docs/output/json
Package json converts the webapi records into json.
Package json converts the webapi records into json.
tooling/docs/output/text
Package text converts the webapi records into text output.
Package text converts the webapi records into text output.
tooling/docs/webapi
Package webapi provides support for extracting web api information from reading the code.
Package webapi provides support for extracting web api information from reading the code.
tooling/logfmt
This program takes the structured log output and makes it readable.
This program takes the structured log output and makes it readable.
business
core/division
Package division ...
Package division ...
core/division/stores/divisionjson
Package divisionjson ...
Package divisionjson ...
core/user
Package user provides an example of a core business API.
Package user provides an example of a core business API.
core/user/stores/usercache
Package usercache contains user related CRUD functionality with caching.
Package usercache contains user related CRUD functionality with caching.
core/user/stores/userdb
Package userdb contains user related CRUD functionality.
Package userdb contains user related CRUD functionality.
data/dbmigrate
Package dbmigrate contains the database schema, migrations and seeding data.
Package dbmigrate contains the database schema, migrations and seeding data.
data/dbsql/pgx
Package db provides support for access the database.
Package db provides support for access the database.
data/dbsql/pgx/dbarray
Package dbarray provides support for database array types.
Package dbarray provides support for database array types.
data/dbsql/pq
Package db provides support for access the database.
Package db provides support for access the database.
data/dbtest
Package dbtest contains supporting code for running tests that hit the DB.
Package dbtest contains supporting code for running tests that hit the DB.
data/order
Package order provides support for describing the ordering of data.
Package order provides support for describing the ordering of data.
data/transaction
Package transaction provides support for database transaction related functionality.
Package transaction provides support for database transaction related functionality.
web/auth
Package auth provides authentication and authorization support.
Package auth provides authentication and authorization support.
web/debug
Package debug provides handler support for the debugging endpoints.
Package debug provides handler support for the debugging endpoints.
web/httpclient
Package httpclient implements a wrapper of http client supports logging, tracing, and proxy
Package httpclient implements a wrapper of http client supports logging, tracing, and proxy
web/metrics
Package metrics constructs the metrics the application will track.
Package metrics constructs the metrics the application will track.
web/mid
Package mid contains the set of middleware functions.
Package mid contains the set of middleware functions.
web/response
Package response provides the response and error handling types support.
Package response provides the response and error handling types support.
foundation
docker
Package docker provides support for starting and stopping docker containers for running tests.
Package docker provides support for starting and stopping docker containers for running tests.
keystore
Package keystore implements the auth.KeyLookup interface.
Package keystore implements the auth.KeyLookup interface.
logger
Package logger provides support for initializing the log system.
Package logger provides support for initializing the log system.
sms
Package sms provide utilities for sending sms esms docs: https://developers.esms.vn
Package sms provide utilities for sending sms esms docs: https://developers.esms.vn
validate
Package validate contains the support for validating models.
Package validate contains the support for validating models.
vault
Package vault provides support for accessing Hashicorp's vault service to access private keys.
Package vault provides support for accessing Hashicorp's vault service to access private keys.
web
Package web contains a small web framework extension.
Package web contains a small web framework extension.
worker
Package worker manages a set of registered jobs that execute on demand.
Package worker manages a set of registered jobs that execute on demand.
zarf
keys
Package keys stores development public/private key pairs used by the service.
Package keys stores development public/private key pairs used by the service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL