Remove unused SQL queries and update email template handling
- Deleted multiple unused SQL query files from the cms-service. - Refactored email template handling in the cms-service to improve clarity and maintainability. - Updated environment variable loading in both cms-service and lms-service to use dotenvy for better configuration management. - Added a new .env.dev file for local development with database and SMTP configurations. - Set default value for `certificates_enabled` in the shared common models.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# Database URLs for local development
|
||||
CMS_DATABASE_URL=postgresql://user:password@localhost:5432/openccb_cms
|
||||
LMS_DATABASE_URL=postgresql://user:password@localhost:5432/openccb_lms
|
||||
|
||||
# General fallback
|
||||
DATABASE_URL=postgresql://user:password@localhost:5432/openccb_cms
|
||||
|
||||
# JWT Secret
|
||||
JWT_SECRET=dev_jwt_secret_change_in_production
|
||||
|
||||
# Logging
|
||||
RUST_LOG=debug
|
||||
|
||||
# AI Configuration
|
||||
# Providers: 'openai' or 'local'
|
||||
AI_PROVIDER=local
|
||||
OPENAI_API_KEY=
|
||||
|
||||
# Local AI (Ollama & Whisper) - Production (HTTPS with SSH tunnel)
|
||||
PROD_WHISPER_URL=http://host.docker.internal:8080
|
||||
|
||||
# SMTP for local development
|
||||
SMTP_ENABLED=true
|
||||
SMTP_HOST=mailpit
|
||||
SMTP_PORT=1025
|
||||
SMTP_FROM=OpenCCB Dev <dev@norteamericano.com>
|
||||
SMTP_USERNAME=
|
||||
SMTP_PASSWORD=
|
||||
|
||||
# Next.js public variables for local development
|
||||
NEXT_PUBLIC_CMS_API_URL=http://localhost:3001
|
||||
NEXT_PUBLIC_LMS_API_URL=http://localhost:3002/lms-api
|
||||
NEXT_PUBLIC_STUDIO_DOMAIN=localhost
|
||||
NEXT_PUBLIC_LEARNING_DOMAIN=localhost
|
||||
|
||||
# MySQL for courses integration (local)
|
||||
MYSQL_DATABASE_URL=mysql://user:password@host.docker.internal:3306/courses_db
|
||||
|
||||
# SAM Diagnostico DB (local)
|
||||
SAM_DIAGNOSTICO_DATABASE_URL=postgresql://user:password@host.docker.internal:5434/sam_db
|
||||
@@ -17,14 +17,26 @@ services:
|
||||
|
||||
db:
|
||||
ports:
|
||||
- "5433:5432"
|
||||
- "5432:5432"
|
||||
|
||||
studio:
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "3001:3001"
|
||||
env_file: .env.dev
|
||||
environment:
|
||||
- NEXT_PUBLIC_CMS_API_URL=http://localhost:3001
|
||||
- NEXT_PUBLIC_LMS_API_URL=http://localhost:3002/lms-api
|
||||
- NEXT_PUBLIC_STUDIO_DOMAIN=localhost
|
||||
- NEXT_PUBLIC_LEARNING_DOMAIN=localhost
|
||||
|
||||
experience:
|
||||
ports:
|
||||
- "3003:3003"
|
||||
- "3002:3002"
|
||||
env_file: .env.dev
|
||||
environment:
|
||||
- NEXT_PUBLIC_CMS_API_URL=http://localhost:3001
|
||||
- NEXT_PUBLIC_LMS_API_URL=http://localhost:3002/lms-api
|
||||
- NEXT_PUBLIC_STUDIO_DOMAIN=localhost
|
||||
- NEXT_PUBLIC_LEARNING_DOMAIN=localhost
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# ============================================================================
|
||||
# PARÁMETROS LOCALES (no editar — se derivan del docker-compose.local.yml)
|
||||
# ============================================================================
|
||||
LOCAL_DB_PORT="5433"
|
||||
LOCAL_DB_PORT="5432"
|
||||
LOCAL_DB_USER="user"
|
||||
LOCAL_DB_PASS="password"
|
||||
LOCAL_CMS_URL="http://localhost:3001"
|
||||
|
||||
-86
@@ -1,86 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n UPDATE library_blocks \n SET name = COALESCE($1, name),\n description = COALESCE($2, description),\n tags = COALESCE($3, tags),\n updated_at = NOW()\n WHERE id = $4 AND organization_id = $5\n RETURNING id, organization_id, created_by, name, description, block_type, block_data, tags, usage_count as \"usage_count!\", created_at, updated_at\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "organization_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "created_by",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "name",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "description",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "block_type",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "block_data",
|
||||
"type_info": "Jsonb"
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "tags",
|
||||
"type_info": "TextArray"
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "usage_count!",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"name": "updated_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Text",
|
||||
"Text",
|
||||
"TextArray",
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "00e1fd1111ece41c0c1494cf92dacaa1127f01bf97ddf71342cf129c3a3275e1"
|
||||
}
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "SELECT rubric_id FROM rubric_criteria WHERE id = $1",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "rubric_id",
|
||||
"type_info": "Uuid"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "13d9a1d22c6a77705cd74ed6d05916d9f84c28b87cb357178400ee7421cbe0bc"
|
||||
}
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n UPDATE rubric_levels\n SET name = COALESCE($1, name),\n description = COALESCE($2, description),\n points = COALESCE($3, points),\n position = COALESCE($4, position)\n WHERE id = $5\n AND criterion_id IN (\n SELECT id FROM rubric_criteria\n WHERE rubric_id IN (SELECT id FROM rubrics WHERE organization_id = $6)\n )\n RETURNING id, criterion_id, name, description, points, position, created_at\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "criterion_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "name",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "description",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "points",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "position",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Varchar",
|
||||
"Text",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "17b6ee6e225ecf0573f41c8017f7509bf38d345a697b9b885ec276061baa1cba"
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n INSERT INTO assets (id, organization_id, uploaded_by, course_id, filename, storage_path, mimetype, size_bytes)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8)\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid",
|
||||
"Uuid",
|
||||
"Uuid",
|
||||
"Text",
|
||||
"Text",
|
||||
"Text",
|
||||
"Int8"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "255e2331ed0f3148bd14e1cc2e791c7c91067eea455146923e463036d61e92c7"
|
||||
}
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT id, criterion_id, name, description, points, position, created_at\n FROM rubric_levels\n WHERE criterion_id = $1\n ORDER BY position ASC\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "criterion_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "name",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "description",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "points",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "position",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "2893eec86b904d90f69b96766029f17c80aa86fd3a10d12bef9879b9f25ae23a"
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n UPDATE rubrics\n SET total_points = (SELECT COALESCE(SUM(max_points), 0) FROM rubric_criteria WHERE rubric_id = $1),\n updated_at = NOW()\n WHERE id = $1\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "2abb997f1ef644429883fbd0bd72408bddaa1cea968319f28d5e87011e2bf0b7"
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "DELETE FROM lesson_rubrics WHERE lesson_id = $1 AND rubric_id = $2",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "3747c2088f23d32d110971afcdf8271678069e981fa98749ff7ec26c358a139f"
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n UPDATE rubrics\n SET total_points = (SELECT COALESCE(SUM(max_points), 0) FROM rubric_criteria WHERE rubric_id = $1),\n updated_at = NOW()\n WHERE id = $1\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "42dfabb9428c4d090242fc98e43eb3a8236333ca2305b6ab852dcc90d232ac89"
|
||||
}
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n INSERT INTO lesson_rubrics (lesson_id, rubric_id, is_active)\n VALUES ($1, $2, true)\n ON CONFLICT (lesson_id, rubric_id) DO UPDATE SET is_active = true\n RETURNING id, lesson_id, rubric_id, is_active, assigned_at\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "lesson_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "rubric_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "is_active",
|
||||
"type_info": "Bool"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "assigned_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "45c3ae8b43e4fe46aa4126986b7607996f77213b859e4f47e0a1d16cf4913fd0"
|
||||
}
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT r.id, r.organization_id, r.course_id, r.created_by, r.name, r.description, r.total_points, r.created_at, r.updated_at\n FROM rubrics r\n INNER JOIN lesson_rubrics lr ON lr.rubric_id = r.id\n WHERE lr.lesson_id = $1 AND lr.is_active = true AND r.organization_id = $2\n ORDER BY lr.assigned_at DESC\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "organization_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "course_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "created_by",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "name",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "description",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "total_points",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "updated_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "4687bb156a947f156e401c0d610756e7bb3a1abb0f706d3be347659f485e71de"
|
||||
}
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n INSERT INTO lesson_dependencies (organization_id, lesson_id, prerequisite_lesson_id, min_score_percentage)\n VALUES ($1, $2, $3, $4)\n ON CONFLICT (lesson_id, prerequisite_lesson_id) \n DO UPDATE SET min_score_percentage = EXCLUDED.min_score_percentage\n RETURNING id, organization_id, lesson_id, prerequisite_lesson_id, min_score_percentage, created_at\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "organization_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "lesson_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "prerequisite_lesson_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "min_score_percentage",
|
||||
"type_info": "Float8"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid",
|
||||
"Uuid",
|
||||
"Float8"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "4e61a89bc2207eba7452c77aea850919ec09dfabd2b8e5b5dd84aca3853669eb"
|
||||
}
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT id, organization_id, course_id, created_by, name, description, total_points, created_at, updated_at\n FROM rubrics\n WHERE id = $1 AND organization_id = $2\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "organization_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "course_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "created_by",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "name",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "description",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "total_points",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "updated_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "521e61afe4ab4bf06305447d012ee4bc236f2b3ebce7c788335cf0ca2daf8823"
|
||||
}
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT id, organization_id, course_id, created_by, name, description, total_points, created_at, updated_at\n FROM rubrics\n WHERE organization_id = $1 AND (course_id = $2 OR course_id IS NULL)\n ORDER BY created_at DESC\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "organization_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "course_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "created_by",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "name",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "description",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "total_points",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "updated_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "62c035c29d3b3c5a2fff84713668f6d8a2f6e2cbabf55a6795b218338239d8ab"
|
||||
}
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "SELECT * FROM assets WHERE id = $1 AND organization_id = $2",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "filename",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "storage_path",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "mimetype",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "size_bytes",
|
||||
"type_info": "Int8"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "organization_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "course_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "uploaded_by",
|
||||
"type_info": "Uuid"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "71a9bb3c9b3ba2c851c2dad049291bb46855eca27523952bbf655250039a7468"
|
||||
}
|
||||
-88
@@ -1,88 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n INSERT INTO library_blocks (organization_id, created_by, name, description, block_type, block_data, tags)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n RETURNING id, organization_id, created_by, name, description, block_type, block_data, tags, usage_count as \"usage_count!\", created_at, updated_at\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "organization_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "created_by",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "name",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "description",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "block_type",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "block_data",
|
||||
"type_info": "Jsonb"
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "tags",
|
||||
"type_info": "TextArray"
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "usage_count!",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"name": "updated_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid",
|
||||
"Text",
|
||||
"Text",
|
||||
"Text",
|
||||
"Jsonb",
|
||||
"TextArray"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "7b3e62330c2b8c283aff253e568b65655efd76d54a5e6ac57093a05718af9882"
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "UPDATE library_blocks SET usage_count = usage_count + 1 WHERE id = $1 AND organization_id = $2",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "82e4c85bf3aaa45506e3245c3d7b9e8ab224a8e10f2666e69ef212fb0c000ac0"
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "DELETE FROM assets WHERE id = $1",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "834a48554bc7989975b42afbc40d0128865826a7cc6130441c42e75b46c54dc9"
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "SELECT id FROM rubric_criteria WHERE id = $1 AND rubric_id IN (SELECT id FROM rubrics WHERE organization_id = $2)",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "85fbeda23c72b58439fdedac4c6dbf23b9054354f737f60c23d0b416944b6095"
|
||||
}
|
||||
-73
@@ -1,73 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n UPDATE rubrics\n SET name = COALESCE($1, name),\n description = COALESCE($2, description),\n updated_at = NOW()\n WHERE id = $3 AND organization_id = $4\n RETURNING id, organization_id, course_id, created_by, name, description, total_points, created_at, updated_at\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "organization_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "course_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "created_by",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "name",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "description",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "total_points",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "updated_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Varchar",
|
||||
"Text",
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "8ce98992129f77432d24a5a8a458c52d3a252c10f41d6be67d8696b046e4c18f"
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n INSERT INTO rubric_criteria (rubric_id, name, description, max_points, position)\n VALUES ($1, $2, $3, $4, $5)\n RETURNING id, rubric_id, name, description, max_points, position, created_at\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "rubric_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "name",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "description",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "max_points",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "position",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Varchar",
|
||||
"Text",
|
||||
"Int4",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "914bcec73c3c1399f4e743d3e89289e783b7479592d1c7e11dd677c99d9bb2d3"
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "DELETE FROM lesson_dependencies WHERE lesson_id = $1 AND prerequisite_lesson_id = $2 AND organization_id = $3",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "95ddcf80ff28b2680ebdd9d8ba92aefa34fd99209e228238d86e7d135f6b41e2"
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "DELETE FROM library_blocks WHERE id = $1 AND organization_id = $2",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "b42eb00367a1991125ff01fab2a51a3582512a9265d02c2bcb05ddb80e7c6038"
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "SELECT id FROM rubrics WHERE id = $1 AND organization_id = $2",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "c2a37e2b0139c053b4c4eb88a2cf4b658fbf419795901d565eaaa1e169d881e9"
|
||||
}
|
||||
-85
@@ -1,85 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n UPDATE library_blocks \n SET description = COALESCE($1, description),\n tags = COALESCE($2, tags),\n updated_at = NOW()\n WHERE id = $3 AND organization_id = $4\n RETURNING id, organization_id, created_by, name, description, block_type, block_data, tags, usage_count as \"usage_count!\", created_at, updated_at\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "organization_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "created_by",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "name",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "description",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "block_type",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "block_data",
|
||||
"type_info": "Jsonb"
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "tags",
|
||||
"type_info": "TextArray"
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "usage_count!",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"name": "updated_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Text",
|
||||
"TextArray",
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "cc7467f5734e57f581fab98e7e37a934a7852474ed2eb3ea7b26e4d14b8a4df0"
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n DELETE FROM rubric_criteria\n WHERE id = $1\n AND rubric_id IN (SELECT id FROM rubrics WHERE organization_id = $2)\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "d06f83e2b566ac9a49c63bdfcce03912f6ae1ef00a96fd345d89f22f218aaf1c"
|
||||
}
|
||||
-74
@@ -1,74 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n INSERT INTO rubrics (organization_id, course_id, created_by, name, description)\n VALUES ($1, $2, $3, $4, $5)\n RETURNING id, organization_id, course_id, created_by, name, description, total_points, created_at, updated_at\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "organization_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "course_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "created_by",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "name",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "description",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "total_points",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "updated_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid",
|
||||
"Uuid",
|
||||
"Varchar",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "ddc1f59ea8f744d2357944e68cf49e4176f7dbee191bbdff8876fc88a0e26436"
|
||||
}
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n UPDATE rubric_criteria\n SET name = COALESCE($1, name),\n description = COALESCE($2, description),\n max_points = COALESCE($3, max_points),\n position = COALESCE($4, position)\n WHERE id = $5\n AND rubric_id IN (SELECT id FROM rubrics WHERE organization_id = $6)\n RETURNING id, rubric_id, name, description, max_points, position, created_at\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "rubric_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "name",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "description",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "max_points",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "position",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Varchar",
|
||||
"Text",
|
||||
"Int4",
|
||||
"Int4",
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "e26e27402806a7fa4d85433ed18f25c84a2cc2f5eb6b9c2db7562f75755ddc13"
|
||||
}
|
||||
-83
@@ -1,83 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "SELECT id, organization_id, created_by, name, description, block_type, block_data, tags, usage_count as \"usage_count!\", created_at, updated_at FROM library_blocks WHERE id = $1 AND organization_id = $2",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "organization_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "created_by",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "name",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "description",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "block_type",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "block_data",
|
||||
"type_info": "Jsonb"
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "tags",
|
||||
"type_info": "TextArray"
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "usage_count!",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"name": "updated_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "e3065bc94b895c8ced3d16c97bd6a11909ee9d29a2dc30a70123d07b28d12c11"
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "DELETE FROM rubrics WHERE id = $1 AND organization_id = $2",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "e3b659588c9e818f6c89d030ae929280aaee5c922c1f01420dc061336cb1c159"
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n DELETE FROM rubric_levels\n WHERE id = $1\n AND criterion_id IN (\n SELECT id FROM rubric_criteria\n WHERE rubric_id IN (SELECT id FROM rubrics WHERE organization_id = $2)\n )\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "e57d5797051a54d5ad707edeabfad84a6da8d8d7020f049d67c98687e6961194"
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n INSERT INTO rubric_levels (criterion_id, name, description, points, position)\n VALUES ($1, $2, $3, $4, $5)\n RETURNING id, criterion_id, name, description, points, position, created_at\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "criterion_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "name",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "description",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "points",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "position",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Varchar",
|
||||
"Text",
|
||||
"Int4",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "e5ede144c8250e31ce63979c3f1a835eb7e8377cf75c8dc0679ec5c2f9504e98"
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "SELECT id FROM library_blocks WHERE id = $1 AND organization_id = $2",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "ed4f770f0bd31dc8dc731e73843d8c71a2462290c837d72e1def2af3f7a5fc48"
|
||||
}
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "SELECT * FROM lesson_dependencies WHERE lesson_id = $1 AND organization_id = $2",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "organization_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "lesson_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "prerequisite_lesson_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "min_score_percentage",
|
||||
"type_info": "Float8"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "f531c2478ba9634cf935aa615c9320fb99006f6e5e66501a93520af637f8f1a5"
|
||||
}
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT id, rubric_id, name, description, max_points, position, created_at\n FROM rubric_criteria\n WHERE rubric_id = $1\n ORDER BY position ASC\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "rubric_id",
|
||||
"type_info": "Uuid"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "name",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "description",
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "max_points",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "position",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "created_at",
|
||||
"type_info": "Timestamptz"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "f7a592c933c658314ed5228da68f5df87fbfbbb4acda6940b1fe57009517a6b7"
|
||||
}
|
||||
@@ -9,7 +9,7 @@ use serde_json::json;
|
||||
use sqlx::PgPool;
|
||||
use uuid::Uuid;
|
||||
|
||||
use super::handlers::{Org, log_action};
|
||||
use super::handlers::log_action;
|
||||
|
||||
#[derive(Debug, Clone, sqlx::FromRow)]
|
||||
struct OrganizationEmailTemplateRow {
|
||||
@@ -53,25 +53,35 @@ pub async fn list_organization_email_templates(
|
||||
State(pool): State<PgPool>,
|
||||
claims: Claims,
|
||||
) -> Result<Json<Vec<OrganizationEmailTemplateResponse>>, (StatusCode, String)> {
|
||||
let org_id = claims.organization_id.ok_or((
|
||||
StatusCode::BAD_REQUEST,
|
||||
"Organization ID required".to_string(),
|
||||
))?;
|
||||
let org_id = claims.org;
|
||||
|
||||
let rows = sqlx::query_as!(
|
||||
OrganizationEmailTemplateRow,
|
||||
let rows: Vec<OrganizationEmailTemplateRow> = sqlx::query!(
|
||||
"SELECT id, organization_id, template_key, display_name, subject_template, body_template, is_html, is_enabled, created_at, updated_at FROM organization_email_templates WHERE organization_id = $1 ORDER BY template_key",
|
||||
org_id
|
||||
)
|
||||
.fetch_all(&pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
.map_err(|e: sqlx::Error| {
|
||||
eprintln!("Error fetching email templates: {:?}", e);
|
||||
(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
"Failed to fetch email templates".to_string(),
|
||||
)
|
||||
})?;
|
||||
})?
|
||||
.into_iter()
|
||||
.map(|row| OrganizationEmailTemplateRow {
|
||||
id: row.id,
|
||||
organization_id: row.organization_id,
|
||||
template_key: row.template_key,
|
||||
display_name: row.display_name,
|
||||
subject_template: row.subject_template,
|
||||
body_template: row.body_template,
|
||||
is_html: row.is_html,
|
||||
is_enabled: row.is_enabled,
|
||||
created_at: row.created_at.expect("created_at should not be null"),
|
||||
updated_at: row.updated_at.expect("updated_at should not be null"),
|
||||
})
|
||||
.collect();
|
||||
|
||||
let responses = rows
|
||||
.into_iter()
|
||||
@@ -97,15 +107,11 @@ pub async fn create_organization_email_template(
|
||||
claims: Claims,
|
||||
Json(payload): Json<UpsertOrganizationEmailTemplatePayload>,
|
||||
) -> Result<Json<OrganizationEmailTemplateResponse>, (StatusCode, String)> {
|
||||
let org_id = claims.organization_id.ok_or((
|
||||
StatusCode::BAD_REQUEST,
|
||||
"Organization ID required".to_string(),
|
||||
))?;
|
||||
let org_id = claims.org;
|
||||
|
||||
validate_template_payload(&payload)?;
|
||||
|
||||
let row = sqlx::query_as!(
|
||||
OrganizationEmailTemplateRow,
|
||||
let row = sqlx::query!(
|
||||
"INSERT INTO organization_email_templates (organization_id, template_key, display_name, subject_template, body_template, is_html, is_enabled)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
||||
RETURNING id, organization_id, template_key, display_name, subject_template, body_template, is_html, is_enabled, created_at, updated_at",
|
||||
@@ -119,7 +125,7 @@ pub async fn create_organization_email_template(
|
||||
)
|
||||
.fetch_one(&pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
.map_err(|e: sqlx::Error| {
|
||||
eprintln!("Error creating email template: {:?}", e);
|
||||
if e.to_string().contains("duplicate key") {
|
||||
(
|
||||
@@ -134,12 +140,27 @@ pub async fn create_organization_email_template(
|
||||
}
|
||||
})?;
|
||||
|
||||
let row = OrganizationEmailTemplateRow {
|
||||
id: row.id,
|
||||
organization_id: row.organization_id,
|
||||
template_key: row.template_key,
|
||||
display_name: row.display_name,
|
||||
subject_template: row.subject_template,
|
||||
body_template: row.body_template,
|
||||
is_html: row.is_html,
|
||||
is_enabled: row.is_enabled,
|
||||
created_at: row.created_at.expect("created_at should not be null"),
|
||||
updated_at: row.updated_at.expect("updated_at should not be null"),
|
||||
};
|
||||
|
||||
log_action(
|
||||
&pool,
|
||||
claims.user_id,
|
||||
org_id,
|
||||
claims.sub,
|
||||
"create_email_template",
|
||||
&json!({
|
||||
"email_template",
|
||||
row.id,
|
||||
json!({
|
||||
"template_key": payload.template_key,
|
||||
"display_name": payload.display_name
|
||||
}),
|
||||
@@ -168,15 +189,11 @@ pub async fn update_organization_email_template(
|
||||
Path(template_id): Path<Uuid>,
|
||||
Json(payload): Json<UpsertOrganizationEmailTemplatePayload>,
|
||||
) -> Result<Json<OrganizationEmailTemplateResponse>, (StatusCode, String)> {
|
||||
let org_id = claims.organization_id.ok_or((
|
||||
StatusCode::BAD_REQUEST,
|
||||
"Organization ID required".to_string(),
|
||||
))?;
|
||||
let org_id = claims.org;
|
||||
|
||||
validate_template_payload(&payload)?;
|
||||
|
||||
let row = sqlx::query_as!(
|
||||
OrganizationEmailTemplateRow,
|
||||
let row = sqlx::query!(
|
||||
"UPDATE organization_email_templates
|
||||
SET display_name = $3, subject_template = $4, body_template = $5, is_html = $6, is_enabled = $7, updated_at = NOW()
|
||||
WHERE id = $1 AND organization_id = $2
|
||||
@@ -191,13 +208,25 @@ pub async fn update_organization_email_template(
|
||||
)
|
||||
.fetch_optional(&pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
.map_err(|e: sqlx::Error| {
|
||||
eprintln!("Error updating email template: {:?}", e);
|
||||
(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
"Failed to update email template".to_string(),
|
||||
)
|
||||
})?
|
||||
.map(|row| OrganizationEmailTemplateRow {
|
||||
id: row.id,
|
||||
organization_id: row.organization_id,
|
||||
template_key: row.template_key,
|
||||
display_name: row.display_name,
|
||||
subject_template: row.subject_template,
|
||||
body_template: row.body_template,
|
||||
is_html: row.is_html,
|
||||
is_enabled: row.is_enabled,
|
||||
created_at: row.created_at.expect("created_at should not be null"),
|
||||
updated_at: row.updated_at.expect("updated_at should not be null"),
|
||||
})
|
||||
.ok_or((
|
||||
StatusCode::NOT_FOUND,
|
||||
"Email template not found".to_string(),
|
||||
@@ -205,10 +234,12 @@ pub async fn update_organization_email_template(
|
||||
|
||||
log_action(
|
||||
&pool,
|
||||
claims.user_id,
|
||||
org_id,
|
||||
claims.sub,
|
||||
"update_email_template",
|
||||
&json!({
|
||||
"email_template",
|
||||
template_id,
|
||||
json!({
|
||||
"template_id": template_id,
|
||||
"template_key": payload.template_key,
|
||||
"display_name": payload.display_name
|
||||
@@ -237,10 +268,7 @@ pub async fn delete_organization_email_template(
|
||||
claims: Claims,
|
||||
Path(template_id): Path<Uuid>,
|
||||
) -> Result<StatusCode, (StatusCode, String)> {
|
||||
let org_id = claims.organization_id.ok_or((
|
||||
StatusCode::BAD_REQUEST,
|
||||
"Organization ID required".to_string(),
|
||||
))?;
|
||||
let org_id = claims.org;
|
||||
|
||||
let result = sqlx::query!(
|
||||
"DELETE FROM organization_email_templates WHERE id = $1 AND organization_id = $2",
|
||||
@@ -249,7 +277,7 @@ pub async fn delete_organization_email_template(
|
||||
)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
.map_err(|e: sqlx::Error| {
|
||||
eprintln!("Error deleting email template: {:?}", e);
|
||||
(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
@@ -266,10 +294,12 @@ pub async fn delete_organization_email_template(
|
||||
|
||||
log_action(
|
||||
&pool,
|
||||
claims.user_id,
|
||||
org_id,
|
||||
claims.sub,
|
||||
"delete_email_template",
|
||||
&json!({"template_id": template_id}),
|
||||
"email_template",
|
||||
template_id,
|
||||
json!({"template_id": template_id}),
|
||||
)
|
||||
.await;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ use tower_http::trace::TraceLayer;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
dotenv().ok();
|
||||
dotenvy::from_filename(".env.dev").or_else(|_| dotenv()).ok();
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
let db_url = env::var("DATABASE_URL").expect("DATABASE_URL debe estar configurada");
|
||||
|
||||
@@ -35,7 +35,7 @@ use utoipa::OpenApi;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
dotenv().ok();
|
||||
dotenvy::from_filename(".env.dev").or_else(|_| dotenv()).ok();
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
let db_url = env::var("DATABASE_URL").expect("DATABASE_URL debe estar configurada");
|
||||
|
||||
@@ -999,6 +999,7 @@ mod tests {
|
||||
primary_color: None,
|
||||
secondary_color: None,
|
||||
certificate_template: None,
|
||||
certificates_enabled: true,
|
||||
platform_name: None,
|
||||
favicon_url: None,
|
||||
logo_variant: None,
|
||||
|
||||
Reference in New Issue
Block a user