(
userId: string,
action: string,
count: number,
currentDate: Date,
isWeekend: boolean,
targetType: string,
metadata?: Prisma.InputJsonValue,
)
| 144 | } |
| 145 | |
| 146 | async function createAudits( |
| 147 | userId: string, |
| 148 | action: string, |
| 149 | count: number, |
| 150 | currentDate: Date, |
| 151 | isWeekend: boolean, |
| 152 | targetType: string, |
| 153 | metadata?: Prisma.InputJsonValue, |
| 154 | ) { |
| 155 | for (let i = 0; i < count; i++) { |
| 156 | await prisma.audit.create({ |
| 157 | data: { |
| 158 | timestamp: randomTimestamp(currentDate, isWeekend), |
| 159 | action, |
| 160 | actorId: userId, |
| 161 | actorType: 'user', |
| 162 | targetId: `${targetType}_${Math.floor(Math.random() * 1000)}`, |
| 163 | targetType, |
| 164 | sourcebotVersion: '1.0.0', |
| 165 | orgId, |
| 166 | ...(metadata ? { metadata } : {}), |
| 167 | } |
| 168 | }); |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | // Generate data for each day |
| 173 | for (let d = new Date(startDate); d <= endDate; d.setDate(d.getDate() + 1)) { |
no test coverage detected