Skip to content

Commit 116573b

Browse files
committed
Add comprehensive documentation for ObjectQL hooks, API, security model, and metadata specifications
- Introduced examples and detailed explanations for lifecycle hooks in `logic-hooks-examples.md`. - Expanded the `logic-hooks.md` to cover the lifecycle hooks, their signatures, and registration processes. - Documented the ObjectQL API in `sdk-reference.md`, detailing context management, query and mutation APIs, and advanced features. - Established a security model in `security-guide.md`, outlining RBAC and policy definitions. - Specified metadata format and query language in `metadata-format.md` and `query-language.md`, respectively. - Created a REST API reference in `http-protocol.md`, detailing standard and advanced endpoints for CRUD operations.
1 parent 22a570e commit 116573b

File tree

12 files changed

+130
-0
lines changed

12 files changed

+130
-0
lines changed

docs/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# ObjectQL Documentation
2+
3+
We have organized the documentation into two main categories:
4+
5+
## 1. [User & Developer Guide](./guide/README.md)
6+
**Target Audience**: Application Developers, Customer Success, End Users.
7+
**Content**:
8+
* How to model data (Objects, Fields, Relationships).
9+
* How to write business logic (Hooks, Actions).
10+
* Using the Node.js SDK.
11+
* Security configuration.
12+
13+
## 2. [Protocol Specifications](./spec/README.md)
14+
**Target Audience**: System Architects, Driver Contributors, Integrators.
15+
**Content**:
16+
* Metadata File Format Specification (YAML/JSON schema).
17+
* Unified Query Language Protocol.
18+
* Low-level HTTP API Reference.

docs/guide/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Developer & User Guide
2+
3+
Welcome to the ObjectQL User Guide. This documentation is designed to help you build applications using the ObjectQL platform.
4+
5+
## 1. Essentials
6+
* [**Data Modeling Guide**](./data-modeling.md) (Recommended First Read)
7+
* Learn how to define Objects, Fields, and Relationships.
8+
* Guide to using rich field types: Email, URL, Files, Images, and Formulas.
9+
* [**Security Guide**](./security-guide.md)
10+
* Understanding authentication and permissions.
11+
12+
## 2. Server-Side Logic
13+
* [**SDK Reference**](./sdk-reference.md)
14+
* Using the Node.js API to query and manipulate data.
15+
* [**Hooks**](./logic-hooks.md)
16+
* Writing triggers (before/after create, update, delete).
17+
* [**Hooks Examples**](./logic-hooks-examples.md)
18+
* Real-world code snippets for automation.
19+
* [**Custom Actions**](./logic-actions.md)
20+
* Defining custom RPC endpoints.
21+

docs/guide/data-modeling.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Data Modeling Guide
2+
3+
Modeling your business data is the first step in building an ObjectQL application. This guide introduces the core concepts.
4+
5+
## 1. Objects
6+
7+
An **Object** is like a database table. It represents a business entity, such as a Customer, Order, or Product.
8+
9+
```yaml
10+
# customer.object.yml
11+
name: customer
12+
label: Customer
13+
icon: user
14+
description: Stores customer information.
15+
fields:
16+
name:
17+
type: text
18+
label: Full Name
19+
required: true
20+
```
21+
22+
## 2. Fields
23+
24+
Fields store the data attributes for an object. ObjectQL provides a rich set of field types.
25+
26+
### 2.1 Basic Types
27+
* **Text & Area**: `text`, `textarea`, `markdown`, `html`
28+
* **Numbers**: `number`, `currency`, `percent`
29+
* **Switch**: `boolean` (checkbox)
30+
* **Date**: `date`, `datetime`, `time`
31+
* **System**: `password`, `auto_number`
32+
33+
### 2.2 Format Types
34+
These types provide automatic validation and formatted display.
35+
* **Email** (`email`): Validates email addresses.
36+
* **Phone** (`phone`): Stores phone numbers.
37+
* **URL** (`url`): Validates web links.
38+
39+
### 2.3 Media & Files
40+
* **File** (`file`): Upload generic documents.
41+
* **Image** (`image`): Upload pictures with preview support.
42+
* **Avatar** (`avatar`): User profile pictures.
43+
44+
*Note: You can allow multiple files/images by setting `multiple: true`.*
45+
46+
### 2.4 Location
47+
* **Location** (`location`): Stores Latitude and Longitude. Useful for maps.
48+
49+
### 2.5 Calculations
50+
* **Formula**: Calculate values automatically based on other fields.
51+
* Example: `Total` = `Price` * `Quantity`
52+
* **Summary**: Aggregate data from child records (e.g., Total Order Amount for a Customer).
53+
54+
## 3. Relationships
55+
56+
Linking objects together is powerful.
57+
58+
* **Lookup**: A simple link to another object. (e.g., An Order looks up a Customer).
59+
* **Master-Detail**: A strong parent-child relationship. If the parent is deleted, children are deleted.
60+
61+
```yaml
62+
# order.object.yml
63+
fields:
64+
customer:
65+
type: lookup
66+
reference_to: customer
67+
label: Customer
68+
```
69+
70+
## 4. Attributes
71+
72+
You can enforce rules on your data using attributes:
73+
74+
* `required`: Cannot be empty.
75+
* `unique`: Must be unique in the whole table.
76+
* `min`, `max`: Range validation for numbers.
77+
* `defaultValue`: Automatic initial value.
78+
* `hidden`: Hide from standard UI.
79+
* `readonly`: Prevent editing in UI.
80+
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/spec/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Protocol Specifications
2+
3+
This section contains the technical specifications for the ObjectQL platform. It is intended for driver developers, system integrators, and anyone who needs to understand the low-level protocols.
4+
5+
* [**Metadata Format**](./metadata-format.md)
6+
* Complete definition of the YAML/JSON schema for Objects and Fields.
7+
* Includes new types: `file`, `image`, `location`, `formula`, `summary`, etc.
8+
* [**Query Language (JSON)**](./query-language.md)
9+
* Specification of the Unified Query JSON format used by drivers and APIs.
10+
* [**HTTP Protocol**](./http-protocol.md)
11+
* Standard REST API endpoints and payload formats.
File renamed without changes.

0 commit comments

Comments
 (0)