@trafficgroup/knex-rel 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cameras_analysis.md +199 -0
- package/dist/dao/camera/camera.dao.d.ts +13 -0
- package/dist/dao/camera/camera.dao.js +93 -0
- package/dist/dao/camera/camera.dao.js.map +1 -0
- package/dist/dao/folder/folder.dao.js +6 -3
- package/dist/dao/folder/folder.dao.js.map +1 -1
- package/dist/dao/video/video.dao.d.ts +5 -0
- package/dist/dao/video/video.dao.js +46 -0
- package/dist/dao/video/video.dao.js.map +1 -1
- package/dist/index.d.ts +12 -10
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/dist/interfaces/camera/camera.interfaces.d.ts +9 -0
- package/dist/interfaces/camera/camera.interfaces.js +3 -0
- package/dist/interfaces/camera/camera.interfaces.js.map +1 -0
- package/dist/interfaces/folder/folder.interfaces.d.ts +3 -0
- package/dist/interfaces/video/video.interfaces.d.ts +4 -0
- package/folder_cameraid_analysis.md +167 -0
- package/migrations/20250911000000_migration.ts +61 -0
- package/migrations/20250917144153_migration.ts +37 -0
- package/migrations/20250924000000_camera_name_search_index.ts +22 -0
- package/package.json +1 -1
- package/plan.md +288 -0
- package/src/dao/camera/camera.dao.ts +79 -0
- package/src/dao/folder/folder.dao.ts +18 -3
- package/src/dao/video/video.dao.ts +49 -0
- package/src/index.ts +12 -10
- package/src/interfaces/camera/camera.interfaces.ts +9 -0
- package/src/interfaces/folder/folder.interfaces.ts +3 -0
- package/src/interfaces/video/video.interfaces.ts +4 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Database Schema Analysis - Cameras Table Implementation
|
|
2
|
+
|
|
3
|
+
## Current Schema Analysis
|
|
4
|
+
|
|
5
|
+
### 1. Videos Table (Current Structure)
|
|
6
|
+
|
|
7
|
+
- **Table Name**: `video`
|
|
8
|
+
- **Primary Key**: `id` (auto-increment number)
|
|
9
|
+
- **UUID**: `uuid` (unique, not null) - for external references
|
|
10
|
+
- **Foreign Keys**:
|
|
11
|
+
- `folderId`: references `folders.id` (CASCADE delete)
|
|
12
|
+
- `cameraId`: references `cameras.id` (SET NULL on delete) ✅ **ALREADY EXISTS**
|
|
13
|
+
- `annotationSourceId`: self-reference to `video.id` (SET NULL)
|
|
14
|
+
- **Key Fields**:
|
|
15
|
+
- `videoLocation`: S3 path/URL for video file
|
|
16
|
+
- `videoRate`: frame rate (FPS)
|
|
17
|
+
- `videoType`: enum ['TMC', 'ATR', 'JUNCTION', 'ROUNDABOUT', 'PATHWAY']
|
|
18
|
+
- `status`: enum ['QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED', 'PENDING']
|
|
19
|
+
- `metadata`: JSONB for lane annotations
|
|
20
|
+
- `results`: JSONB for processing results
|
|
21
|
+
- **Timestamps**: `created_at`, `updated_at`
|
|
22
|
+
- **Indexes**:
|
|
23
|
+
- `uuid` (unique)
|
|
24
|
+
- `cameraId`
|
|
25
|
+
- `annotationSourceId`
|
|
26
|
+
- Composite: `(folderId, videoType, status)`
|
|
27
|
+
|
|
28
|
+
### 2. Folders Table (Current Structure)
|
|
29
|
+
|
|
30
|
+
- **Table Name**: `folders`
|
|
31
|
+
- **Primary Key**: `id` (auto-increment number)
|
|
32
|
+
- **UUID**: `uuid` (unique, not null) - for external references
|
|
33
|
+
- **Foreign Keys**:
|
|
34
|
+
- `createdBy`: references `user.id` (CASCADE delete)
|
|
35
|
+
- `studyId`: references `study.id` (CASCADE delete)
|
|
36
|
+
- `cameraId`: references `cameras.id` (SET NULL on delete) ✅ **ALREADY EXISTS**
|
|
37
|
+
- **Key Fields**:
|
|
38
|
+
- `name`: folder name
|
|
39
|
+
- `status`: enum ['UPLOADING', 'COMPLETE']
|
|
40
|
+
- **Timestamps**: `created_at`, `updated_at`
|
|
41
|
+
- **Indexes**:
|
|
42
|
+
- `uuid` (unique)
|
|
43
|
+
- `cameraId`
|
|
44
|
+
|
|
45
|
+
### 3. Cameras Table (Current Structure) ✅ **ALREADY IMPLEMENTED**
|
|
46
|
+
|
|
47
|
+
- **Table Name**: `cameras`
|
|
48
|
+
- **Primary Key**: `id` (auto-increment number)
|
|
49
|
+
- **UUID**: `uuid` (unique, not null) - for external references
|
|
50
|
+
- **Fields**:
|
|
51
|
+
- `name`: string(100), not null
|
|
52
|
+
- `longitude`: decimal(10,7), not null
|
|
53
|
+
- `latitude`: decimal(10,7), not null
|
|
54
|
+
- **Timestamps**: `created_at`, `updated_at`
|
|
55
|
+
- **Indexes**:
|
|
56
|
+
- `uuid` (unique)
|
|
57
|
+
- Composite: `(longitude, latitude)` for geospatial queries
|
|
58
|
+
|
|
59
|
+
## Relationship Analysis
|
|
60
|
+
|
|
61
|
+
### Current Relationships ✅ **FULLY IMPLEMENTED**
|
|
62
|
+
|
|
63
|
+
1. **Study → Folders** (One-to-Many)
|
|
64
|
+
- Foreign key: `folders.studyId → study.id`
|
|
65
|
+
- Cascade delete: deleting study removes all folders
|
|
66
|
+
|
|
67
|
+
2. **Folders → Videos** (One-to-Many)
|
|
68
|
+
- Foreign key: `video.folderId → folders.id`
|
|
69
|
+
- Cascade delete: deleting folder removes all videos
|
|
70
|
+
|
|
71
|
+
3. **Cameras → Folders** (One-to-Many) ✅
|
|
72
|
+
- Foreign key: `folders.cameraId → cameras.id`
|
|
73
|
+
- SET NULL on delete: deleting camera keeps folders but removes reference
|
|
74
|
+
|
|
75
|
+
4. **Cameras → Videos** (One-to-Many) ✅
|
|
76
|
+
- Foreign key: `video.cameraId → cameras.id`
|
|
77
|
+
- SET NULL on delete: deleting camera keeps videos but removes reference
|
|
78
|
+
|
|
79
|
+
5. **Videos → Videos** (Self-Reference for Templates)
|
|
80
|
+
- Foreign key: `video.annotationSourceId → video.id`
|
|
81
|
+
- Used for lane annotation templates
|
|
82
|
+
|
|
83
|
+
## DAO Implementation Status
|
|
84
|
+
|
|
85
|
+
### CameraDAO ✅ **FULLY IMPLEMENTED**
|
|
86
|
+
|
|
87
|
+
- **File**: `src/dao/camera/camera.dao.ts`
|
|
88
|
+
- **Standard Methods**: create, getById, getByUuid, update, delete, getAll ✅
|
|
89
|
+
- **Custom Methods**:
|
|
90
|
+
- `getByName(name: string)`: Find camera by name ✅
|
|
91
|
+
- `getCamerasNearCoordinates(lng, lat, radius)`: Geospatial search using PostGIS ✅
|
|
92
|
+
- **Performance Features**: Uses PostGIS ST_DWithin for geographic queries ✅
|
|
93
|
+
|
|
94
|
+
### VideoDAO - Camera Integration ✅ **ALREADY INTEGRATED**
|
|
95
|
+
|
|
96
|
+
- **JOIN Queries**: Already includes folder data in getById/getByUuid ✅
|
|
97
|
+
- **Camera Support**: Interface includes `cameraId?: number` and `camera?: ICamera` ✅
|
|
98
|
+
- **Note**: DAO doesn't currently JOIN camera data, but interface supports it
|
|
99
|
+
|
|
100
|
+
### FolderDAO - Camera Integration ✅ **ALREADY INTEGRATED**
|
|
101
|
+
|
|
102
|
+
- **JOIN Queries**: Already includes study data in getById/getByUuid ✅
|
|
103
|
+
- **Camera Support**: Interface includes `cameraId?: number` and `camera?: ICamera` ✅
|
|
104
|
+
- **Note**: DAO doesn't currently JOIN camera data, but interface supports it
|
|
105
|
+
|
|
106
|
+
## Migration Status ✅ **COMPLETE**
|
|
107
|
+
|
|
108
|
+
**Migration**: `20250911000000_migration.ts` ✅ **ALREADY DEPLOYED**
|
|
109
|
+
|
|
110
|
+
- Creates `cameras` table with proper schema ✅
|
|
111
|
+
- Adds `cameraId` to `video` table with foreign key ✅
|
|
112
|
+
- Adds `cameraId` to `folders` table with foreign key ✅
|
|
113
|
+
- Proper indexes for performance ✅
|
|
114
|
+
- Safe rollback implementation ✅
|
|
115
|
+
|
|
116
|
+
## Interface Implementation Status ✅ **COMPLETE**
|
|
117
|
+
|
|
118
|
+
### ICamera ✅ **FULLY IMPLEMENTED**
|
|
119
|
+
|
|
120
|
+
- **File**: `src/interfaces/camera/camera.interfaces.ts`
|
|
121
|
+
- **Fields**: id, uuid, name, longitude, latitude, created_at, updated_at ✅
|
|
122
|
+
- **Export**: Properly exported in `src/index.ts` ✅
|
|
123
|
+
|
|
124
|
+
### IVideo ✅ **CAMERA INTEGRATION COMPLETE**
|
|
125
|
+
|
|
126
|
+
- **Camera Fields**: `cameraId?: number`, `camera?: ICamera` ✅
|
|
127
|
+
- **Relationships**: Imports ICamera interface ✅
|
|
128
|
+
|
|
129
|
+
### IFolder ✅ **CAMERA INTEGRATION COMPLETE**
|
|
130
|
+
|
|
131
|
+
- **Camera Fields**: `cameraId?: number`, `camera?: ICamera` ✅
|
|
132
|
+
- **Relationships**: Imports ICamera interface ✅
|
|
133
|
+
|
|
134
|
+
## Performance Considerations ✅ **OPTIMIZED**
|
|
135
|
+
|
|
136
|
+
### Database Indexes ✅
|
|
137
|
+
|
|
138
|
+
- `cameras.uuid` (unique) - for UUID lookups ✅
|
|
139
|
+
- `cameras(longitude, latitude)` - for geospatial queries ✅
|
|
140
|
+
- `video.cameraId` - for camera-to-videos lookups ✅
|
|
141
|
+
- `folders.cameraId` - for camera-to-folders lookups ✅
|
|
142
|
+
|
|
143
|
+
### Query Optimization ✅
|
|
144
|
+
|
|
145
|
+
- **VideoDAO**: Uses JOINs to eliminate N+1 queries (folder data) ✅
|
|
146
|
+
- **FolderDAO**: Uses JOINs to eliminate N+1 queries (study data) ✅
|
|
147
|
+
- **CameraDAO**: Geospatial queries use PostGIS for performance ✅
|
|
148
|
+
|
|
149
|
+
### Missing JOIN Optimizations (Minor Enhancement Opportunity)
|
|
150
|
+
|
|
151
|
+
- VideoDAO could JOIN camera data in getById/getByUuid queries
|
|
152
|
+
- FolderDAO could JOIN camera data in getById/getByUuid queries
|
|
153
|
+
- These would eliminate additional queries when camera data is needed
|
|
154
|
+
|
|
155
|
+
## System Architecture Compliance ✅
|
|
156
|
+
|
|
157
|
+
### Pattern Compliance ✅
|
|
158
|
+
|
|
159
|
+
- **Naming**: Follows `entityUuid` pattern for external references ✅
|
|
160
|
+
- **Timestamps**: Uses `created_at`/`updated_at` consistently ✅
|
|
161
|
+
- **Primary Keys**: Auto-increment `id` for internal use ✅
|
|
162
|
+
- **Foreign Keys**: Proper referential integrity with appropriate cascade rules ✅
|
|
163
|
+
|
|
164
|
+
### TypeScript Integration ✅
|
|
165
|
+
|
|
166
|
+
- **Type Safety**: Full TypeScript interfaces with proper typing ✅
|
|
167
|
+
- **Optional Fields**: Camera relationships marked as optional ✅
|
|
168
|
+
- **Export Structure**: All entities properly exported from main index ✅
|
|
169
|
+
|
|
170
|
+
## Current Implementation Status: ✅ **COMPLETE**
|
|
171
|
+
|
|
172
|
+
### What's Already Working:
|
|
173
|
+
|
|
174
|
+
1. **Database Schema**: Cameras table exists with proper relationships ✅
|
|
175
|
+
2. **Migrations**: All database changes deployed ✅
|
|
176
|
+
3. **DAOs**: CameraDAO fully implemented with geospatial features ✅
|
|
177
|
+
4. **Interfaces**: All TypeScript interfaces support camera relationships ✅
|
|
178
|
+
5. **Exports**: All components properly exported ✅
|
|
179
|
+
6. **Relationships**: Many-to-one relationships correctly implemented ✅
|
|
180
|
+
7. **Performance**: Proper indexing for UUID and geospatial queries ✅
|
|
181
|
+
|
|
182
|
+
### Minor Optimization Opportunities:
|
|
183
|
+
|
|
184
|
+
1. **JOIN Queries**: VideoDAO and FolderDAO could include camera data in their JOIN queries
|
|
185
|
+
2. **Query Performance**: Consider adding camera data to reduce roundtrips
|
|
186
|
+
|
|
187
|
+
## Conclusion
|
|
188
|
+
|
|
189
|
+
The cameras table implementation is **COMPLETE and FULLY FUNCTIONAL**. The database schema, migrations, DAOs, and interfaces are all properly implemented following the project's architectural patterns. The system supports:
|
|
190
|
+
|
|
191
|
+
- ✅ Camera management with geographic coordinates
|
|
192
|
+
- ✅ Many-to-one relationships between cameras and folders/videos
|
|
193
|
+
- ✅ UUID-based external references
|
|
194
|
+
- ✅ Geospatial queries for location-based camera searches
|
|
195
|
+
- ✅ Proper foreign key constraints with appropriate cascade behavior
|
|
196
|
+
- ✅ Full TypeScript type safety
|
|
197
|
+
- ✅ Performance optimization through proper indexing
|
|
198
|
+
|
|
199
|
+
**No database changes are required** - the system is ready for camera-based video processing workflows.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IBaseDAO, IDataPaginator } from "../../d.types";
|
|
2
|
+
import { ICamera } from "../../interfaces/camera/camera.interfaces";
|
|
3
|
+
export declare class CameraDAO implements IBaseDAO<ICamera> {
|
|
4
|
+
private _knex;
|
|
5
|
+
create(item: ICamera): Promise<ICamera>;
|
|
6
|
+
getById(id: number): Promise<ICamera | null>;
|
|
7
|
+
getByUuid(uuid: string): Promise<ICamera | null>;
|
|
8
|
+
update(id: number, item: Partial<ICamera>): Promise<ICamera | null>;
|
|
9
|
+
delete(id: number): Promise<boolean>;
|
|
10
|
+
getAll(page: number, limit: number): Promise<IDataPaginator<ICamera>>;
|
|
11
|
+
getByName(name: string): Promise<ICamera | null>;
|
|
12
|
+
getCamerasNearCoordinates(longitude: number, latitude: number, radiusKm?: number): Promise<ICamera[]>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.CameraDAO = void 0;
|
|
16
|
+
const KnexConnection_1 = __importDefault(require("../../KnexConnection"));
|
|
17
|
+
class CameraDAO {
|
|
18
|
+
constructor() {
|
|
19
|
+
this._knex = KnexConnection_1.default.getConnection();
|
|
20
|
+
}
|
|
21
|
+
create(item) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const [createdCamera] = yield this._knex("cameras")
|
|
24
|
+
.insert(item)
|
|
25
|
+
.returning("*");
|
|
26
|
+
return createdCamera;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
getById(id) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const camera = yield this._knex("cameras").where({ id }).first();
|
|
32
|
+
return camera || null;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
getByUuid(uuid) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const camera = yield this._knex("cameras").where({ uuid }).first();
|
|
38
|
+
return camera || null;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
update(id, item) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const [updatedCamera] = yield this._knex("cameras")
|
|
44
|
+
.where({ id })
|
|
45
|
+
.update(item)
|
|
46
|
+
.returning("*");
|
|
47
|
+
return updatedCamera || null;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
delete(id) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const result = yield this._knex("cameras").where({ id }).del();
|
|
53
|
+
return result > 0;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
getAll(page, limit) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const offset = (page - 1) * limit;
|
|
59
|
+
const [countResult] = yield this._knex("cameras").count("* as count");
|
|
60
|
+
const totalCount = +countResult.count;
|
|
61
|
+
const cameras = yield this._knex("cameras").limit(limit).offset(offset);
|
|
62
|
+
return {
|
|
63
|
+
success: true,
|
|
64
|
+
data: cameras,
|
|
65
|
+
page,
|
|
66
|
+
limit,
|
|
67
|
+
count: cameras.length,
|
|
68
|
+
totalCount,
|
|
69
|
+
totalPages: Math.ceil(totalCount / limit),
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
getByName(name) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
const camera = yield this._knex("cameras").where({ name }).first();
|
|
76
|
+
return camera || null;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
getCamerasNearCoordinates(longitude_1, latitude_1) {
|
|
80
|
+
return __awaiter(this, arguments, void 0, function* (longitude, latitude, radiusKm = 1) {
|
|
81
|
+
// Using ST_DWithin for geographic distance calculation
|
|
82
|
+
// This is a PostgreSQL-specific query for geospatial operations
|
|
83
|
+
const cameras = yield this._knex("cameras").whereRaw(`ST_DWithin(
|
|
84
|
+
ST_MakePoint(longitude, latitude)::geography,
|
|
85
|
+
ST_MakePoint(?, ?)::geography,
|
|
86
|
+
?
|
|
87
|
+
)`, [longitude, latitude, radiusKm * 1000]);
|
|
88
|
+
return cameras;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.CameraDAO = CameraDAO;
|
|
93
|
+
//# sourceMappingURL=camera.dao.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera.dao.js","sourceRoot":"","sources":["../../../src/dao/camera/camera.dao.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,0EAA+C;AAE/C,MAAa,SAAS;IAAtB;QACU,UAAK,GAAyB,wBAAW,CAAC,aAAa,EAAE,CAAC;IAwEpE,CAAC;IAtEO,MAAM,CAAC,IAAa;;YACxB,MAAM,CAAC,aAAa,CAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;iBAChD,MAAM,CAAC,IAAI,CAAC;iBACZ,SA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,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC;YACtC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAExE,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,OAAO;gBACb,IAAI;gBACJ,KAAK;gBACL,KAAK,EAAE,OAAO,CAAC,MAAM;gBACrB,UAAU;gBACV,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;aAC1C,CAAC;QACJ,CAAC;KAAA;IAEK,SAAS,CAAC,IAAY;;YAC1B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YACnE,OAAO,MAAM,IAAI,IAAI,CAAC;QACxB,CAAC;KAAA;IAEK,yBAAyB;6DAC7B,SAAiB,EACjB,QAAgB,EAChB,WAAmB,CAAC;YAEpB,uDAAuD;YACvD,gEAAgE;YAChE,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,QAAQ,CAClD;;;;kBAIY,EACZ,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC,CACvC,CAAC;YACF,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;CACF;AAzED,8BAyEC"}
|
|
@@ -30,7 +30,8 @@ class FolderDAO {
|
|
|
30
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
31
|
const folder = yield this._knex("folders as f")
|
|
32
32
|
.innerJoin("study as s", "f.studyId", "s.id")
|
|
33
|
-
.
|
|
33
|
+
.leftJoin("cameras as c", "f.cameraId", "c.id")
|
|
34
|
+
.select("f.*", this._knex.raw("to_jsonb(s.*) as study"), this._knex.raw("to_jsonb(c.*) as camera"))
|
|
34
35
|
.where("f.id", id)
|
|
35
36
|
.first();
|
|
36
37
|
return folder || null;
|
|
@@ -40,7 +41,8 @@ class FolderDAO {
|
|
|
40
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
42
|
const folder = yield this._knex("folders as f")
|
|
42
43
|
.innerJoin("study as s", "f.studyId", "s.id")
|
|
43
|
-
.
|
|
44
|
+
.leftJoin("cameras as c", "f.cameraId", "c.id")
|
|
45
|
+
.select("f.*", this._knex.raw("to_jsonb(s.*) as study"), this._knex.raw("to_jsonb(c.*) as camera"))
|
|
44
46
|
.where("f.uuid", uuid)
|
|
45
47
|
.first();
|
|
46
48
|
return folder || null;
|
|
@@ -66,7 +68,8 @@ class FolderDAO {
|
|
|
66
68
|
const offset = (page - 1) * limit;
|
|
67
69
|
const query = this._knex("folders as f")
|
|
68
70
|
.innerJoin("study as s", "f.studyId", "s.id")
|
|
69
|
-
.
|
|
71
|
+
.leftJoin("cameras as c", "f.cameraId", "c.id")
|
|
72
|
+
.select("f.*", this._knex.raw("to_jsonb(s.*) as study"), this._knex.raw("to_jsonb(c.*) as camera"));
|
|
70
73
|
if (studyId !== undefined && studyId !== null) {
|
|
71
74
|
query.where("f.studyId", studyId);
|
|
72
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder.dao.js","sourceRoot":"","sources":["../../../src/dao/folder/folder.dao.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,0EAA+C;AAE/C,MAAa,SAAS;IAAtB;QACU,UAAK,GAAyB,wBAAW,CAAC,aAAa,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"folder.dao.js","sourceRoot":"","sources":["../../../src/dao/folder/folder.dao.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,0EAA+C;AAE/C,MAAa,SAAS;IAAtB;QACU,UAAK,GAAyB,wBAAW,CAAC,aAAa,EAAE,CAAC;IAmFpE,CAAC;IAjFO,MAAM,CAAC,IAAa;;YACxB,MAAM,CA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,MAAM,CAAC,MAAM,CAAC,CAAC;YAEhE,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,OAAO;gBACb,IAAI;gBACJ,KAAK;gBACL,KAAK,EAAE,OAAO,CAAC,MAAM;gBACrB,UAAU;gBACV,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;aAC1C,CAAC;QACJ,CAAC;KAAA;CACF;AApFD,8BAoFC"}
|
|
@@ -25,4 +25,9 @@ export declare class VideoDAO implements IBaseDAO<IVideo> {
|
|
|
25
25
|
* Get videos that don't have minute-by-minute data yet
|
|
26
26
|
*/
|
|
27
27
|
getVideosWithoutMinuteData(page: number, limit: number): Promise<IDataPaginator<IVideo>>;
|
|
28
|
+
/**
|
|
29
|
+
* Get videos from same folder with same type that have metadata and are COMPLETED
|
|
30
|
+
* Suitable for use as lane annotation templates
|
|
31
|
+
*/
|
|
32
|
+
getTemplateVideos(folderId: number, videoType: string): Promise<IVideo[]>;
|
|
28
33
|
}
|
|
@@ -166,6 +166,52 @@ class VideoDAO {
|
|
|
166
166
|
};
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Get videos from same folder with same type that have metadata and are COMPLETED
|
|
171
|
+
* Suitable for use as lane annotation templates
|
|
172
|
+
*/
|
|
173
|
+
getTemplateVideos(folderId, videoType) {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
try {
|
|
176
|
+
let query = this._knex("video")
|
|
177
|
+
.where("folderId", folderId)
|
|
178
|
+
.where("videoType", videoType)
|
|
179
|
+
.where("status", "COMPLETED")
|
|
180
|
+
.whereNotNull("metadata")
|
|
181
|
+
.whereRaw("metadata != '{}'");
|
|
182
|
+
// Apply video type specific metadata validation
|
|
183
|
+
if (videoType === "ATR") {
|
|
184
|
+
// ATR videos use lanes array structure
|
|
185
|
+
query = query.whereRaw("jsonb_array_length(metadata->'lanes') > 0");
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
// TMC/JUNCTION/ROUNDABOUT/PATHWAY videos use objects with pt1/pt2 structure
|
|
189
|
+
// Check if metadata has at least one key with pt1 and pt2 properties
|
|
190
|
+
query = query.whereRaw(`
|
|
191
|
+
EXISTS (
|
|
192
|
+
SELECT 1
|
|
193
|
+
FROM jsonb_each(metadata) as entry(key, value)
|
|
194
|
+
WHERE key != 'lanes'
|
|
195
|
+
AND key != 'finish_line'
|
|
196
|
+
AND jsonb_typeof(value) = 'object'
|
|
197
|
+
AND value ? 'pt1'
|
|
198
|
+
AND value ? 'pt2'
|
|
199
|
+
AND jsonb_typeof(value->'pt1') = 'array'
|
|
200
|
+
AND jsonb_typeof(value->'pt2') = 'array'
|
|
201
|
+
AND jsonb_array_length(value->'pt1') = 2
|
|
202
|
+
AND jsonb_array_length(value->'pt2') = 2
|
|
203
|
+
)
|
|
204
|
+
`);
|
|
205
|
+
}
|
|
206
|
+
const videos = yield query.orderBy("updated_at", "desc").select("*");
|
|
207
|
+
return videos;
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
console.error("Error fetching template videos:", error);
|
|
211
|
+
throw error;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
169
215
|
}
|
|
170
216
|
exports.VideoDAO = VideoDAO;
|
|
171
217
|
//# sourceMappingURL=video.dao.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.dao.js","sourceRoot":"","sources":["../../../src/dao/video/video.dao.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,0EAA+C;AAE/C,MAAa,QAAQ;IAArB;QACU,UAAK,GAAyB,wBAAW,CAAC,aAAa,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"video.dao.js","sourceRoot":"","sources":["../../../src/dao/video/video.dao.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,0EAA+C;AAE/C,MAAa,QAAQ;IAArB;QACU,UAAK,GAAyB,wBAAW,CA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AAK,CAAC,QAAQ,CAAC,2CAA2C,CAAC,CAAC;gBACtE,CAAC;qBAAM,CAAC;oBACN,4EAA4E;oBAC5E,qEAAqE;oBACrE,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;iBAcd,CAAC,CAAC;gBACb,CAAC;gBAED,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAErE,OAAO,MAAM,CAAC;YAChB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;gBACxD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KAAA;CACF;AAlPD,4BAkPC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
export { UserDAO } from "./dao/user/user.dao";
|
|
2
|
-
export { StudyDAO } from "./dao/study/study.dao";
|
|
3
|
-
export { FolderDAO } from "./dao/folder/folder.dao";
|
|
4
|
-
export { VideoDAO } from "./dao/video/video.dao";
|
|
5
1
|
export { AuthDAO } from "./dao/auth/auth.dao";
|
|
6
|
-
export {
|
|
2
|
+
export { CameraDAO } from "./dao/camera/camera.dao";
|
|
7
3
|
export { ChatDAO } from "./dao/chat/chat.dao";
|
|
4
|
+
export { FolderDAO } from "./dao/folder/folder.dao";
|
|
8
5
|
export { MessageDAO } from "./dao/message/message.dao";
|
|
6
|
+
export { StudyDAO } from "./dao/study/study.dao";
|
|
7
|
+
export { UserDAO } from "./dao/user/user.dao";
|
|
8
|
+
export { UserPushNotificationTokenDAO } from "./dao/user-push-notification-token/user-push-notification-token.dao";
|
|
9
|
+
export { VideoDAO } from "./dao/video/video.dao";
|
|
9
10
|
export { VideoMinuteResultDAO } from "./dao/VideoMinuteResultDAO";
|
|
10
11
|
export { IDataPaginator } from "./d.types";
|
|
11
|
-
export { IUser } from "./interfaces/user/user.interfaces";
|
|
12
|
-
export { IStudy } from "./interfaces/study/study.interfaces";
|
|
13
|
-
export { IFolder } from "./interfaces/folder/folder.interfaces";
|
|
14
|
-
export { IVideo } from "./interfaces/video/video.interfaces";
|
|
15
12
|
export { IAuth } from "./interfaces/auth/auth.interfaces";
|
|
16
|
-
export {
|
|
13
|
+
export { ICamera } from "./interfaces/camera/camera.interfaces";
|
|
17
14
|
export { IChat, IChatCreate, IChatUpdate, } from "./interfaces/chat/chat.interfaces";
|
|
15
|
+
export { IFolder } from "./interfaces/folder/folder.interfaces";
|
|
18
16
|
export { IMessage, IMessageCreate, IMessageUpdate, } from "./interfaces/message/message.interfaces";
|
|
17
|
+
export { IStudy } from "./interfaces/study/study.interfaces";
|
|
18
|
+
export { IUser } from "./interfaces/user/user.interfaces";
|
|
19
|
+
export { IUserPushNotificationToken } from "./interfaces/user-push-notification-token/user-push-notification-token.interfaces";
|
|
20
|
+
export { IVideo } from "./interfaces/video/video.interfaces";
|
|
19
21
|
export { IVideoMinuteResult, IVideoMinuteResultInput, IVideoMinuteBatch, } from "./entities/VideoMinuteResult";
|
|
20
22
|
import KnexManager from "./KnexConnection";
|
|
21
23
|
export { KnexManager };
|
package/dist/index.js
CHANGED
|
@@ -3,24 +3,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.KnexManager = exports.VideoMinuteResultDAO = exports.
|
|
6
|
+
exports.KnexManager = exports.VideoMinuteResultDAO = exports.VideoDAO = exports.UserPushNotificationTokenDAO = exports.UserDAO = exports.StudyDAO = exports.MessageDAO = exports.FolderDAO = exports.ChatDAO = exports.CameraDAO = exports.AuthDAO = void 0;
|
|
7
7
|
// DAOs
|
|
8
|
-
var user_dao_1 = require("./dao/user/user.dao");
|
|
9
|
-
Object.defineProperty(exports, "UserDAO", { enumerable: true, get: function () { return user_dao_1.UserDAO; } });
|
|
10
|
-
var study_dao_1 = require("./dao/study/study.dao");
|
|
11
|
-
Object.defineProperty(exports, "StudyDAO", { enumerable: true, get: function () { return study_dao_1.StudyDAO; } });
|
|
12
|
-
var folder_dao_1 = require("./dao/folder/folder.dao");
|
|
13
|
-
Object.defineProperty(exports, "FolderDAO", { enumerable: true, get: function () { return folder_dao_1.FolderDAO; } });
|
|
14
|
-
var video_dao_1 = require("./dao/video/video.dao");
|
|
15
|
-
Object.defineProperty(exports, "VideoDAO", { enumerable: true, get: function () { return video_dao_1.VideoDAO; } });
|
|
16
8
|
var auth_dao_1 = require("./dao/auth/auth.dao");
|
|
17
9
|
Object.defineProperty(exports, "AuthDAO", { enumerable: true, get: function () { return auth_dao_1.AuthDAO; } });
|
|
18
|
-
var
|
|
19
|
-
Object.defineProperty(exports, "
|
|
10
|
+
var camera_dao_1 = require("./dao/camera/camera.dao");
|
|
11
|
+
Object.defineProperty(exports, "CameraDAO", { enumerable: true, get: function () { return camera_dao_1.CameraDAO; } });
|
|
20
12
|
var chat_dao_1 = require("./dao/chat/chat.dao");
|
|
21
13
|
Object.defineProperty(exports, "ChatDAO", { enumerable: true, get: function () { return chat_dao_1.ChatDAO; } });
|
|
14
|
+
var folder_dao_1 = require("./dao/folder/folder.dao");
|
|
15
|
+
Object.defineProperty(exports, "FolderDAO", { enumerable: true, get: function () { return folder_dao_1.FolderDAO; } });
|
|
22
16
|
var message_dao_1 = require("./dao/message/message.dao");
|
|
23
17
|
Object.defineProperty(exports, "MessageDAO", { enumerable: true, get: function () { return message_dao_1.MessageDAO; } });
|
|
18
|
+
var study_dao_1 = require("./dao/study/study.dao");
|
|
19
|
+
Object.defineProperty(exports, "StudyDAO", { enumerable: true, get: function () { return study_dao_1.StudyDAO; } });
|
|
20
|
+
var user_dao_1 = require("./dao/user/user.dao");
|
|
21
|
+
Object.defineProperty(exports, "UserDAO", { enumerable: true, get: function () { return user_dao_1.UserDAO; } });
|
|
22
|
+
var user_push_notification_token_dao_1 = require("./dao/user-push-notification-token/user-push-notification-token.dao");
|
|
23
|
+
Object.defineProperty(exports, "UserPushNotificationTokenDAO", { enumerable: true, get: function () { return user_push_notification_token_dao_1.UserPushNotificationTokenDAO; } });
|
|
24
|
+
var video_dao_1 = require("./dao/video/video.dao");
|
|
25
|
+
Object.defineProperty(exports, "VideoDAO", { enumerable: true, get: function () { return video_dao_1.VideoDAO; } });
|
|
24
26
|
var VideoMinuteResultDAO_1 = require("./dao/VideoMinuteResultDAO");
|
|
25
27
|
Object.defineProperty(exports, "VideoMinuteResultDAO", { enumerable: true, get: function () { return VideoMinuteResultDAO_1.VideoMinuteResultDAO; } });
|
|
26
28
|
const KnexConnection_1 = __importDefault(require("./KnexConnection"));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO;AACP,gDAA8C;AAArC,mGAAA,OAAO,OAAA;AAChB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO;AACP,gDAA8C;AAArC,mGAAA,OAAO,OAAA;AAChB,sDAAoD;AAA3C,uGAAA,SAAS,OAAA;AAClB,gDAA8C;AAArC,mGAAA,OAAO,OAAA;AAChB,sDAAoD;AAA3C,uGAAA,SAAS,OAAA;AAClB,yDAAuD;AAA9C,yGAAA,UAAU,OAAA;AACnB,mDAAiD;AAAxC,qGAAA,QAAQ,OAAA;AACjB,gDAA8C;AAArC,mGAAA,OAAO,OAAA;AAChB,wHAAmH;AAA1G,gJAAA,4BAA4B,OAAA;AACrC,mDAAiD;AAAxC,qGAAA,QAAQ,OAAA;AACjB,mEAAkE;AAAzD,4HAAA,oBAAoB,OAAA;AA2B7B,sEAA2C;AAClC,sBADF,wBAAW,CACE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera.interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/camera/camera.interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IStudy } from "../study/study.interfaces";
|
|
2
|
+
import type { ICamera } from "../camera/camera.interfaces";
|
|
2
3
|
export interface IFolder {
|
|
3
4
|
id: number;
|
|
4
5
|
uuid: string;
|
|
@@ -6,7 +7,9 @@ export interface IFolder {
|
|
|
6
7
|
createdBy: number;
|
|
7
8
|
status: "UPLOADING" | "COMPLETE";
|
|
8
9
|
studyId: number;
|
|
10
|
+
cameraId?: number;
|
|
9
11
|
created_at: string;
|
|
10
12
|
updated_at: string;
|
|
11
13
|
study?: IStudy;
|
|
14
|
+
camera?: ICamera;
|
|
12
15
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { IFolder } from "../folder/folder.interfaces";
|
|
2
|
+
import type { ICamera } from "../camera/camera.interfaces";
|
|
2
3
|
export interface IVideo {
|
|
3
4
|
id: number;
|
|
4
5
|
uuid: string;
|
|
5
6
|
folderId: number;
|
|
7
|
+
cameraId?: number;
|
|
8
|
+
annotationSourceId?: number;
|
|
6
9
|
name: string;
|
|
7
10
|
videoLocation: string;
|
|
8
11
|
videoOutputLocation: string | null;
|
|
@@ -22,4 +25,5 @@ export interface IVideo {
|
|
|
22
25
|
created_at: string;
|
|
23
26
|
updated_at: string;
|
|
24
27
|
folder?: IFolder;
|
|
28
|
+
camera?: ICamera;
|
|
25
29
|
}
|