# tung24092004/ndt-motel architecture

> Architecture diagram of the GitHub repository tung24092004/ndt-motel, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tung24092004/ndt-motel
- Repository: https://github.com/tung24092004/ndt-motel

## Overview

This Django motel-management application supports tenant and administrator workflows. A tenant can browse rooms, submit a booking and deposit, then access contract, invoice, and payment services; administrators manage bookings, properties, and contracts. Separate capabilities cover co-tenancy, repairs, policies, notifications, and smart-room access, including face-related operations. The views are the request-handling layer, domain services handle selected booking and contract rules, and Django models provide persistent records. README content was absent, so unsampled capabilities are represented only where supported by the source index and routes.

Main entry points: [`motel_management/urls.py`](https://github.com/tung24092004/ndt-motel/blob/main/motel_management/urls.py) (URL routes), [`core/models.py`](https://github.com/tung24092004/ndt-motel/blob/main/core/models.py) (Domain records), [`core/views_hop_dong.py`](https://github.com/tung24092004/ndt-motel/blob/main/core/views_hop_dong.py) (Contract management), [`core/views_dat_phong.py`](https://github.com/tung24092004/ndt-motel/blob/main/core/views_dat_phong.py) (Booking requests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_requests["Request handling"]
  node_routes["URL routes<br/>[urls.py]"]
  node_account["Account access<br/>[views_dang_nhap.py]"]
  node_profile["Tenant profile<br/>[views_tai_khoan.py]"]
end

subgraph group_stay["Stays and rooms"]
  node_booking["Booking requests<br/>[views_dat_phong.py]"]
  node_booking_admin["Booking administration"]
  node_booking_rules["Booking service<br/>[dat_phong.py]"]
  node_contract["Contract management<br/>[views_hop_dong.py]"]
  node_contract_service["Contract service<br/>[hop_dong.py]"]
  node_rooms["Room management<br/>[views_phong.py]"]
  node_properties["Property administration<br/>[views_quan_tri.py]"]
  node_extensions["Lease extensions<br/>[views_gia_han.py]"]
end

subgraph group_operations["Tenant operations"]
  node_invoices["Invoice management<br/>[views_hoa_don.py]"]
  node_payments["Tenant payments"]
  node_co_tenancy["Co-tenancy<br/>[views_o_ghep.py]"]
  node_repairs["Repair requests<br/>[views_sua_chua.py]"]
  node_policies["Policies"]
  node_notifications["Notifications<br/>[views_thong_bao.py]"]
end

subgraph group_access["Smart access"]
  node_smart["Smart-room access"]
end

subgraph group_shared["Shared services"]
  node_models[("Domain records<br/>[models.py]")]
  node_date_rules["Lease date rules<br/>[ngay_thue.py]"]
  node_permissions["Role checks<br/>[phan_quyen.py]"]
  node_audit["Activity audit<br/>[tien_ich.py]"]
end

node_tenant(("Tenant"))
node_admin(("Administrator"))

node_tenant -->|"requests"| node_routes
node_admin -->|"requests"| node_routes
node_routes -->|"dispatches"| node_booking
node_routes -->|"dispatches"| node_booking_admin
node_routes -->|"dispatches"| node_contract
node_routes -->|"dispatches"| node_rooms
node_routes -->|"dispatches"| node_properties
node_routes -->|"dispatches"| node_extensions
node_routes -->|"dispatches"| node_invoices
node_routes -->|"dispatches"| node_payments
node_routes -->|"dispatches"| node_co_tenancy
node_routes -->|"dispatches"| node_repairs
node_routes -->|"dispatches"| node_policies
node_routes -->|"dispatches"| node_notifications
node_routes -->|"dispatches"| node_smart
node_routes -->|"dispatches"| node_account
node_routes -->|"dispatches"| node_profile
node_booking -->|"uses"| node_booking_rules
node_booking -->|"reads and writes"| node_models
node_booking_rules -->|"reads and writes"| node_models
node_booking_admin -.->|"confirms booking"| node_contract_service
node_contract_service -->|"creates contract"| node_models
node_contract_service -->|"calculates dates"| node_date_rules
node_contract -->|"reads and writes"| node_models
node_contract -->|"uses"| node_date_rules
node_contract -->|"checks roles"| node_permissions
node_rooms -->|"reads and writes"| node_models
node_properties -->|"reads and writes"| node_models
node_extensions -->|"reads and writes"| node_models
node_extensions -->|"uses"| node_contract
node_invoices -->|"reads and writes"| node_models
node_payments -.->|"reads and writes"| node_models
node_co_tenancy -->|"reads and writes"| node_models
node_repairs -->|"reads and writes"| node_models
node_policies -->|"reads and writes"| node_models
node_notifications -.->|"reads and writes"| node_models
node_smart -->|"reads and writes"| node_models
node_profile -->|"reads and writes"| node_models
node_account -->|"uses accounts"| node_models
node_properties -->|"records actions"| node_audit
node_audit -->|"writes audit record"| node_models

click node_routes "https://github.com/tung24092004/ndt-motel/blob/main/motel_management/urls.py"
click node_account "https://github.com/tung24092004/ndt-motel/blob/main/core/views_dang_nhap.py"
click node_profile "https://github.com/tung24092004/ndt-motel/blob/main/core/views_tai_khoan.py"
click node_booking "https://github.com/tung24092004/ndt-motel/blob/main/core/views_dat_phong.py"
click node_booking_admin "https://github.com/tung24092004/ndt-motel/blob/main/core/views_quan_tri_dat_phong.py"
click node_booking_rules "https://github.com/tung24092004/ndt-motel/blob/main/core/dich_vu/dat_phong.py"
click node_contract "https://github.com/tung24092004/ndt-motel/blob/main/core/views_hop_dong.py"
click node_contract_service "https://github.com/tung24092004/ndt-motel/blob/main/core/dich_vu/hop_dong.py"
click node_rooms "https://github.com/tung24092004/ndt-motel/blob/main/core/views_phong.py"
click node_properties "https://github.com/tung24092004/ndt-motel/blob/main/core/views_quan_tri.py"
click node_extensions "https://github.com/tung24092004/ndt-motel/blob/main/core/views_gia_han.py"
click node_invoices "https://github.com/tung24092004/ndt-motel/blob/main/core/views_hoa_don.py"
click node_payments "https://github.com/tung24092004/ndt-motel/blob/main/core/views_thanh_toan.py"
click node_co_tenancy "https://github.com/tung24092004/ndt-motel/blob/main/core/views_o_ghep.py"
click node_repairs "https://github.com/tung24092004/ndt-motel/blob/main/core/views_sua_chua.py"
click node_policies "https://github.com/tung24092004/ndt-motel/blob/main/core/views_chinh_sach.py"
click node_notifications "https://github.com/tung24092004/ndt-motel/blob/main/core/views_thong_bao.py"
click node_smart "https://github.com/tung24092004/ndt-motel/blob/main/core/views_smart_room.py"
click node_models "https://github.com/tung24092004/ndt-motel/blob/main/core/models.py"
click node_date_rules "https://github.com/tung24092004/ndt-motel/blob/main/core/dich_vu/ngay_thue.py"
click node_permissions "https://github.com/tung24092004/ndt-motel/blob/main/core/dich_vu/phan_quyen.py"
click node_audit "https://github.com/tung24092004/ndt-motel/blob/main/core/tien_ich.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_routes,node_account,node_profile toneBlue
class node_booking,node_booking_admin,node_booking_rules,node_contract,node_contract_service,node_rooms,node_properties,node_extensions toneAmber
class node_invoices,node_payments,node_co_tenancy,node_repairs,node_policies,node_notifications toneMint
class node_smart toneRose
class node_models,node_date_rules,node_permissions,node_audit,node_tenant,node_admin toneIndigo
```

## Components

### Request handling

- [URL routes](https://github.com/tung24092004/ndt-motel/blob/main/motel_management/urls.py): `motel_management/urls.py`
- [Account access](https://github.com/tung24092004/ndt-motel/blob/main/core/views_dang_nhap.py): `core/views_dang_nhap.py`
- [Tenant profile](https://github.com/tung24092004/ndt-motel/blob/main/core/views_tai_khoan.py): `core/views_tai_khoan.py`

### Stays and rooms

- [Booking requests](https://github.com/tung24092004/ndt-motel/blob/main/core/views_dat_phong.py): `core/views_dat_phong.py`
- [Booking administration](https://github.com/tung24092004/ndt-motel/blob/main/core/views_quan_tri_dat_phong.py): `core/views_quan_tri_dat_phong.py`
- [Booking service](https://github.com/tung24092004/ndt-motel/blob/main/core/dich_vu/dat_phong.py): `core/dich_vu/dat_phong.py`
- [Contract management](https://github.com/tung24092004/ndt-motel/blob/main/core/views_hop_dong.py): `core/views_hop_dong.py`
- [Contract service](https://github.com/tung24092004/ndt-motel/blob/main/core/dich_vu/hop_dong.py): `core/dich_vu/hop_dong.py`
- [Room management](https://github.com/tung24092004/ndt-motel/blob/main/core/views_phong.py): `core/views_phong.py`
- [Property administration](https://github.com/tung24092004/ndt-motel/blob/main/core/views_quan_tri.py): `core/views_quan_tri.py`
- [Lease extensions](https://github.com/tung24092004/ndt-motel/blob/main/core/views_gia_han.py): `core/views_gia_han.py`

### Tenant operations

- [Invoice management](https://github.com/tung24092004/ndt-motel/blob/main/core/views_hoa_don.py): `core/views_hoa_don.py`
- [Tenant payments](https://github.com/tung24092004/ndt-motel/blob/main/core/views_thanh_toan.py): `core/views_thanh_toan.py`
- [Co-tenancy](https://github.com/tung24092004/ndt-motel/blob/main/core/views_o_ghep.py): `core/views_o_ghep.py`
- [Repair requests](https://github.com/tung24092004/ndt-motel/blob/main/core/views_sua_chua.py): `core/views_sua_chua.py`
- [Policies](https://github.com/tung24092004/ndt-motel/blob/main/core/views_chinh_sach.py): `core/views_chinh_sach.py`
- [Notifications](https://github.com/tung24092004/ndt-motel/blob/main/core/views_thong_bao.py): `core/views_thong_bao.py`

### Smart access

- [Smart-room access](https://github.com/tung24092004/ndt-motel/blob/main/core/views_smart_room.py): `core/views_smart_room.py`

### Shared services

- [Domain records](https://github.com/tung24092004/ndt-motel/blob/main/core/models.py): `core/models.py`
- [Lease date rules](https://github.com/tung24092004/ndt-motel/blob/main/core/dich_vu/ngay_thue.py): `core/dich_vu/ngay_thue.py`
- [Role checks](https://github.com/tung24092004/ndt-motel/blob/main/core/dich_vu/phan_quyen.py): `core/dich_vu/phan_quyen.py`
- [Activity audit](https://github.com/tung24092004/ndt-motel/blob/main/core/tien_ich.py): `core/tien_ich.py`

### Other components

- **Tenant**
- **Administrator**

## Connections

- Tenant → URL routes: requests (evidence: `motel_management/urls.py`)
- Administrator → URL routes: requests (evidence: `motel_management/urls.py`)
- URL routes → Booking requests: dispatches (evidence: `motel_management/urls.py`)
- URL routes → Booking administration: dispatches (evidence: `motel_management/urls.py`)
- URL routes → Contract management: dispatches (evidence: `motel_management/urls.py`)
- URL routes → Room management: dispatches (evidence: `motel_management/urls.py`)
- URL routes → Property administration: dispatches (evidence: `motel_management/urls.py`)
- URL routes → Lease extensions: dispatches (evidence: `motel_management/urls.py`)
- URL routes → Invoice management: dispatches (evidence: `motel_management/urls.py`)
- URL routes → Tenant payments: dispatches (evidence: `motel_management/urls.py`)
- URL routes → Co-tenancy: dispatches (evidence: `motel_management/urls.py`)
- URL routes → Repair requests: dispatches (evidence: `motel_management/urls.py`)
- URL routes → Policies: dispatches (evidence: `motel_management/urls.py`)
- URL routes → Notifications: dispatches (evidence: `motel_management/urls.py`)
- URL routes → Smart-room access: dispatches (evidence: `motel_management/urls.py`)
- URL routes → Account access: dispatches (evidence: `motel_management/urls.py`)
- URL routes → Tenant profile: dispatches (evidence: `motel_management/urls.py`)
- Booking requests → Booking service: uses (evidence: `core/views_dat_phong.py`)
- Booking requests → Domain records: reads and writes (evidence: `core/views_dat_phong.py`)
- Booking service → Domain records: reads and writes (evidence: `core/dich_vu/dat_phong.py`)
- Booking administration → Contract service: confirms booking
- Contract service → Domain records: creates contract (evidence: `core/dich_vu/hop_dong.py`)
- Contract service → Lease date rules: calculates dates (evidence: `core/dich_vu/hop_dong.py`)
- Contract management → Domain records: reads and writes (evidence: `core/views_hop_dong.py`)
- Contract management → Lease date rules: uses (evidence: `core/views_hop_dong.py`)
- Contract management → Role checks: checks roles (evidence: `core/views_hop_dong.py`)
- Room management → Domain records: reads and writes (evidence: `core/views_phong.py`)
- Property administration → Domain records: reads and writes (evidence: `core/views_quan_tri.py`)
- Lease extensions → Domain records: reads and writes (evidence: `core/views_gia_han.py`)
- Lease extensions → Contract management: uses (evidence: `core/views_gia_han.py`)
- Invoice management → Domain records: reads and writes (evidence: `core/views_hoa_don.py`)
- Tenant payments → Domain records: reads and writes
- Co-tenancy → Domain records: reads and writes (evidence: `core/views_o_ghep.py`)
- Repair requests → Domain records: reads and writes (evidence: `core/views_sua_chua.py`)
- Policies → Domain records: reads and writes (evidence: `core/views_chinh_sach.py`)
- Notifications → Domain records: reads and writes
- Smart-room access → Domain records: reads and writes (evidence: `core/views_smart_room.py`)
- Tenant profile → Domain records: reads and writes (evidence: `core/views_tai_khoan.py`)
- Account access → Domain records: uses accounts (evidence: `core/views_dang_nhap.py`)
- Property administration → Activity audit: records actions (evidence: `core/views_quan_tri.py`)
- Activity audit → Domain records: writes audit record (evidence: `core/tien_ich.py`)
