diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/Callora-Backend.iml b/.idea/Callora-Backend.iml
new file mode 100644
index 0000000..d6ebd48
--- /dev/null
+++ b/.idea/Callora-Backend.iml
@@ -0,0 +1,9 @@
+
+
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| 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 | + + + + + + + + + +7x + + + +6x + + + +2x +2x + + + +1x +1x + + + +2x + + + +2x + + | import { pool } from '../db';
+
+export interface ApiRecord {
+id: number;
+name: string;
+endpoint: string;
+}
+
+export class ApiRepository {
+async create(data: Omit<ApiRecord, 'id'>): Promise<ApiRecord> {
+ const result = await pool.query(
+ 'INSERT INTO apis (name, endpoint) VALUES ($1, $2) RETURNING *',
+ [data.name, data.endpoint]
+ );
+ return result.rows[0];
+ }
+
+ async findById(id: number): Promise<ApiRecord | null> {
+ const result = await pool.query('SELECT * FROM apis WHERE id = $1', [id]);
+ return result.rows[0] || null;
+ }
+
+ async findAll(): Promise<ApiRecord[]> {
+ const result = await pool.query('SELECT * FROM apis ORDER BY id ASC');
+ return result.rows;
+ }
+
+ async update(id: number, data: Partial<ApiRecord>): Promise<ApiRecord | null> {
+ const result = await pool.query(
+ 'UPDATE apis SET name = COALESCE($1, name), endpoint = COALESCE($2, endpoint) WHERE id = $3 RETURNING *',
+ [data.name, data.endpoint, id]
+ );
+ return result.rows[0] || null;
+ }
+} |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| File | ++ | Statements | ++ | Branches | ++ | Functions | ++ | Lines | ++ |
|---|---|---|---|---|---|---|---|---|---|
| ApiRepository.ts | +
+
+ |
+ 100% | +8/8 | +100% | +4/4 | +100% | +4/4 | +100% | +8/8 | +