11# Liberty API
22
3- ** Description:** API For Liberty Framework
3+ ** Description:**
4+ ** Liberty API** provides a powerful and scalable backend for managing authentication,
5+ database operations, and framework functionalities in the ** Liberty Framework** .
6+
7+ ### 🔹 Key Features:
8+ - ** Authentication & Authorization** : Secure endpoints with JWT tokens and OAuth2.
9+ - ** Database Management** : Query, insert, update, and delete records across multiple pools.
10+ - ** Framework Controls** : Manage modules, applications, themes, and logs.
11+ - ** Security & Encryption** : Encrypt data and ensure safe database access.
12+ - ** Logging & Auditing** : Retrieve and analyze logs for security and debugging.
13+
14+ ### 🔹 Authentication
15+ - ** ` /api/auth/token ` ** - Generate a JWT token for authentication.
16+ - ** ` /api/auth/user ` ** - Retrieve authenticated user details.
17+
18+ ### 🔹 Database Operations
19+ - ** ` /api/db/check ` ** - Validate database connection.
20+ - ** ` /api/db/query ` ** - Retrieve, insert, update, or delete records.
21+ - ** ` /api/db/audit/{table}/{user} ` ** - Audit changes on a specific table.
22+
23+ ### 🔹 Framework Features
24+ - ** ` /api/fmw/modules ` ** - Retrieve framework modules.
25+ - ** ` /api/fmw/applications ` ** - Retrieve available applications.
26+ - ** ` /api/fmw/themes ` ** - Manage application themes.
27+
28+ ** 🔗 Explore the API using Swagger UI (` /api/test ` ) or Redoc (` /api ` ).**
29+
430
531** Version:** 1.0.0
632
@@ -43,32 +69,8 @@ Retrieve user information.
4369 "status": "success"
4470 }
4571 ```
46- ??? warning "Response ` 422 ` : Validation Error "
72+ ??? warning "Response ` 422 ` : Unprocessable Entity "
4773 - ** Content-Type:** ` application/json `
48- - ** Example:**
49-
50- ```json
51- {
52- "detail": [
53- {
54- "loc": [
55- "query",
56- "name"
57- ],
58- "msg": "field required",
59- "type": "value_error.missing"
60- },
61- {
62- "loc": [
63- "query",
64- "quantity"
65- ],
66- "msg": "value is not a valid integer",
67- "type": "type_error.integer"
68- }
69- ]
70- }
71- ```
7274??? danger "Response ` 500 ` : Internal server error"
7375 - ** Content-Type:** ` application/json `
7476 - ** Example:**
@@ -98,7 +100,29 @@ Generate a JWT token for the user.
98100
99101 ```json
100102 {
101- "$ref": "#/components/schemas/LoginRequest"
103+ "properties": {
104+ "user": {
105+ "type": "string",
106+ "title": "User"
107+ },
108+ "password": {
109+ "anyOf": [
110+ {
111+ "type": "string"
112+ },
113+ {
114+ "type": "null"
115+ }
116+ ],
117+ "title": "Password"
118+ }
119+ },
120+ "type": "object",
121+ "required": [
122+ "user",
123+ "password"
124+ ],
125+ "title": "LoginRequest"
102126 }
103127 ```
104128** 📥 Responses:**
@@ -620,7 +644,7 @@ Performs a basic check to ensure the database connection is functional. Returns
620644 "rows": [
621645 {
622646 "ROW_ID": 1,
623- "CURRENT_TIME ": "2025-01-27T08:14:13.809494+00:00"
647+ "CURRENT_DATE ": "2025-01-27T08:14:13.809494+00:00"
624648 }
625649 ],
626650 "rowCount": 1,
@@ -630,7 +654,7 @@ Performs a basic check to ensure the database connection is functional. Returns
630654 "type": "int"
631655 },
632656 {
633- "name": "CURRENT_TIME ",
657+ "name": "CURRENT_DATE ",
634658 "type": "datetime"
635659 }
636660 ]
@@ -927,10 +951,75 @@ Audit user actions on a table.
927951 - ** ` user ` ** * (in path)* : No description (** Required** )
928952** 📥 Responses:**
929953
930- ??? success "Response ` 200 ` : Successful Response "
954+ ??? success "Response ` 200 ` : Data inserted/updated successfully "
931955 - ** Content-Type:** ` application/json `
956+ - ** Example:**
957+
958+ ```json
959+ {
960+ "items": [],
961+ "status": "success",
962+ "count": 0
963+ }
964+ ```
965+ ??? warning "Response ` 400 ` : Bad Request"
966+ - ** Content-Type:** ` application/json `
967+ - ** Example:**
968+
969+ ```json
970+ {
971+ "status": "failed",
972+ "message": "Request body cannot be empty. JSON object with key-value pairs is required."
973+ }
974+ ```
932975??? warning "Response ` 422 ` : Validation Error"
933976 - ** Content-Type:** ` application/json `
977+ - ** Example:**
978+
979+ ```json
980+ {
981+ "detail": [
982+ {
983+ "loc": [
984+ "query",
985+ "name"
986+ ],
987+ "msg": "field required",
988+ "type": "value_error.missing"
989+ },
990+ {
991+ "loc": [
992+ "query",
993+ "quantity"
994+ ],
995+ "msg": "value is not a valid integer",
996+ "type": "type_error.integer"
997+ }
998+ ]
999+ }
1000+ ```
1001+ ??? danger "Response ` 500 ` : Internal server error"
1002+ - ** Content-Type:** ` application/json `
1003+ - ** Example:**
1004+
1005+ ```json
1006+ {
1007+ "status": "failed",
1008+ "message": {
1009+ "items": [
1010+ {
1011+ "message": "Error: Query execution failed: Query execution failed: INSERT INTO...",
1012+ "line": {
1013+ "field1": "<string>",
1014+ "field2": "<string>"
1015+ }
1016+ }
1017+ ],
1018+ "status": "error",
1019+ "count": 0
1020+ }
1021+ }
1022+ ```
9341023
9351024---
9361025
0 commit comments