11import { insertLogs } from '/api/clickhouse-client.ts'
22import {
3- type Project ,
4- type Team ,
5- type User ,
63 DeploymentsCollection ,
4+ type Project ,
75 ProjectsCollection ,
6+ type Team ,
87 TeamsCollection ,
8+ type User ,
99 UsersCollection ,
1010} from '/api/schema.ts'
1111
@@ -28,14 +28,25 @@ const users: User[] = [
2828 userPicture : undefined ,
2929 isAdmin : false ,
3030 } ,
31+ {
32+ 33+ userFullName : 'Clement' ,
34+ userPicture : undefined ,
35+ isAdmin : true ,
36+ } ,
37+ {
38+ 39+ userFullName : 'Abdou Top' ,
40+ userPicture : undefined ,
41+ isAdmin : true ,
42+ } ,
3143]
3244
3345const teams : Team [ ] = [
3446 {
3547 teamId : 'frontend-devs' ,
3648 teamName : 'Frontend Devs' ,
37- teamMembers :
[ '[email protected] ' , 38- 49+ 3950 } ,
4051 {
4152 teamId : 'backend-devs' ,
@@ -107,7 +118,7 @@ async function seed() {
107118
108119 // Seed projects
109120 console . log ( 'Seeding projects...' )
110- for ( const [ i , project ] of projects . entries ( ) ) {
121+ for ( const [ _ , project ] of projects . entries ( ) ) {
111122 await ProjectsCollection . insert ( project )
112123 const url = `${ project . slug } .com`
113124 const deployement = await DeploymentsCollection . insert ( {
@@ -121,16 +132,19 @@ async function seed() {
121132 } )
122133 const service_instance_id = crypto . randomUUID ( )
123134 const now = Date . now ( ) / 1000
124- insertLogs ( deployement . url , [ ...Array ( 100 ) . keys ( ) ] . map ( n => ( {
125- attributes : { a : 'str' , bool : true , num : n } ,
126- event_name : `test-log-${ n } ` ,
127- severity_number : Math . floor ( Math . random ( ) * 24 ) ,
128- service_instance_id,
129- span_id : ( now - n ) + Math . random ( ) ,
130- trace_id : ( now - n ) + Math . random ( ) ,
131- service_version : 'v2' ,
132- timestamp : ( now - n ) * 1000 ,
133- } ) ) )
135+ insertLogs (
136+ deployement . url ,
137+ [ ...Array ( 100 ) . keys ( ) ] . map ( ( n ) => ( {
138+ attributes : { a : 'str' , bool : true , num : n } ,
139+ event_name : `test-log-${ n } ` ,
140+ severity_number : Math . floor ( Math . random ( ) * 24 ) ,
141+ service_instance_id,
142+ span_id : ( now - n ) + Math . random ( ) ,
143+ trace_id : ( now - n ) + Math . random ( ) ,
144+ service_version : 'v2' ,
145+ timestamp : ( now - n ) * 1000 ,
146+ } ) ) ,
147+ )
134148 }
135149 console . log ( 'Projects seeded.' )
136150
0 commit comments