Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 41 additions & 10 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,48 @@ jobs:
fi
sleep 1
done
# Create database and setup schema

- name: Setup Database
run: |
# Create the test database
docker exec gecko-postgres-test psql -U postgres -c "CREATE DATABASE testdb;"

# Create the table
docker exec gecko-postgres-test psql -U postgres -d testdb -c "
CREATE TABLE IF NOT EXISTS documents (
name VARCHAR(255) PRIMARY KEY,
content JSONB
);"
DO \$\$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_namespace WHERE nspname = 'config_schema') THEN
CREATE SCHEMA config_schema;
END IF;
END \$\$;

CREATE OR REPLACE FUNCTION create_config_table(schema_name TEXT, table_name TEXT)
RETURNS void AS \$\$
BEGIN
EXECUTE format('
CREATE TABLE IF NOT EXISTS %I.%I (
name VARCHAR(255) PRIMARY KEY,
content JSONB
);
', schema_name, table_name);
END;
\$\$ LANGUAGE plpgsql;

DO \$\$
DECLARE
config_tables TEXT[] := ARRAY['explorer', 'nav', 'file_summary', 'apps_page'];
table_name TEXT;
BEGIN
FOREACH table_name IN ARRAY config_tables
LOOP
PERFORM create_config_table('config_schema', table_name);
END LOOP;
END \$\$;

DROP FUNCTION create_config_table(TEXT, TEXT);
"
env:
PGPASSWORD: your_strong_password



- name: Start Qdrant
run: |
docker rm -f gecko-qdrant-test > /dev/null 2>&1 || true
Expand All @@ -68,10 +93,16 @@ jobs:
done


- name: Start Application
- name: Run Tests
run: |
make
./bin/gecko -db "postgresql://postgres:your_strong_password@localhost:8081/testdb?sslmode=disable" -port 8080 -qdrant-api-key "your_qdrant_api_key" -qdrant-host localhost -qdrant-port 6334 &
./bin/gecko \
-db "postgresql://postgres:your_strong_password@localhost:8081/testdb?sslmode=disable" \
-port 8080 \
-qdrant-api-key "your_qdrant_api_key" \
-qdrant-host localhost \
-qdrant-port 6334 &
# Wait for application to be ready
for i in {1..30}; do
if curl --silent --fail http://localhost:8080/health > /dev/null; then
break
Expand Down
156 changes: 139 additions & 17 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const docTemplate = `{
"paths": {
"/config/list": {
"get": {
"description": "Retrieve a list of all available configurations",
"description": "Retrieve a list of all available configuration IDs for the given type (table).",
"consumes": [
"application/json"
],
Expand All @@ -27,19 +27,28 @@ const docTemplate = `{
"tags": [
"Config"
],
"summary": "List all configurations",
"summary": "List all configuration IDs for a specific type",
"parameters": [
{
"type": "string",
"description": "Configuration Type (table name)",
"name": "configType",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"description": "List of config IDs",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/config.Config"
"type": "string"
}
}
},
"404": {
"description": "No configs found",
"description": "No configs found for this type",
"schema": {
"$ref": "#/definitions/gecko.ErrorResponse"
}
Expand All @@ -53,9 +62,9 @@ const docTemplate = `{
}
}
},
"/config/{configId}": {
"/config/{configType}/{configId}": {
"get": {
"description": "Retrieve configuration by ID",
"description": "Retrieve configuration by configType and configId",
"produces": [
"application/json"
],
Expand All @@ -64,6 +73,13 @@ const docTemplate = `{
],
"summary": "Get a specific configuration",
"parameters": [
{
"type": "string",
"description": "Configuration Type (table name)",
"name": "configType",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Configuration ID",
Expand Down Expand Up @@ -94,7 +110,7 @@ const docTemplate = `{
}
},
"put": {
"description": "Replaces or updates the configuration items for a given config ID",
"description": "Replaces or updates the configuration items for a given config ID in a specific type (table)",
"consumes": [
"application/json"
],
Expand All @@ -106,6 +122,13 @@ const docTemplate = `{
],
"summary": "Update configuration",
"parameters": [
{
"type": "string",
"description": "Configuration Type (table name)",
"name": "configType",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Configuration ID",
Expand Down Expand Up @@ -136,12 +159,6 @@ const docTemplate = `{
"$ref": "#/definitions/gecko.ErrorResponse"
}
},
"404": {
"description": "Config not found",
"schema": {
"$ref": "#/definitions/gecko.ErrorResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
Expand All @@ -151,7 +168,7 @@ const docTemplate = `{
}
},
"delete": {
"description": "Delete configuration by ID",
"description": "Delete configuration by configType and configId",
"produces": [
"application/json"
],
Expand All @@ -160,6 +177,13 @@ const docTemplate = `{
],
"summary": "Delete a configuration",
"parameters": [
{
"type": "string",
"description": "Configuration Type (table name)",
"name": "configType",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Configuration ID",
Expand Down Expand Up @@ -191,6 +215,61 @@ const docTemplate = `{
}
}
},
"/dir/{projectId}": {
"get": {
"description": "Retrieve directory details for the given project ID and Directory path",
"produces": [
"application/json"
],
"tags": [
"Directory"
],
"summary": "Retrieve directory information for a project",
"parameters": [
{
"type": "string",
"description": "Project ID (format: program-project)",
"name": "projectId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Directory Path (e.g., /data/my-dir)",
"name": "directory_path",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "Directory information",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "Invalid request body or Directory path",
"schema": {
"$ref": "#/definitions/gecko.ErrorResponse"
}
},
"403": {
"description": "User is not allowed on any resource path",
"schema": {
"$ref": "#/definitions/gecko.ErrorResponse"
}
},
"500": {
"description": "Server error",
"schema": {
"$ref": "#/definitions/gecko.ErrorResponse"
}
}
}
}
},
"/health": {
"get": {
"description": "Checks the database connection and returns the server status",
Expand Down Expand Up @@ -825,15 +904,15 @@ const docTemplate = `{
},
"payload": {
"type": "object",
"additionalProperties": true
"additionalProperties": {}
},
"score": {
"type": "number"
},
"vectors": {
"description": "can’t type vector length",
"type": "object",
"additionalProperties": true
"additionalProperties": {}
}
}
},
Expand Down Expand Up @@ -1133,14 +1212,57 @@ const docTemplate = `{
}
}
},
"config.SummaryTableColumnType": {
"type": "string",
"enum": [
"string",
"number",
"date",
"array",
"link",
"boolean",
"paragraphs"
],
"x-enum-varnames": [
"SummaryTableColumnTypeString",
"SummaryTableColumnTypeNumber",
"SummaryTableColumnTypeDate",
"SummaryTableColumnTypeArray",
"SummaryTableColumnTypeLink",
"SummaryTableColumnTypeBoolean",
"SummaryTableColumnTypeParagraphs"
]
},
"config.TableColumnsConfig": {
"type": "object",
"properties": {
"accessorPath": {
"type": "string"
},
"cellRenderFunction": {
"type": "string"
},
"field": {
"type": "string"
},
"params": {
"type": "object",
"additionalProperties": {}
},
"sortable": {
"type": "boolean"
},
"title": {
"type": "string"
},
"type": {
"$ref": "#/definitions/config.SummaryTableColumnType"
},
"visable": {
"type": "boolean"
},
"width": {
"type": "string"
}
}
},
Expand Down
Loading