feat: Implement time based filters for executions API endpoint
This commit is contained in:
@@ -566,7 +566,7 @@ class User extends Base {
|
||||
.orderBy('updated_at', 'desc');
|
||||
}
|
||||
|
||||
getExecutions({ name, status }) {
|
||||
getExecutions({ name, status, startDateTime, endDateTime }) {
|
||||
return this.authorizedExecutions
|
||||
.clone()
|
||||
.withSoftDeleted()
|
||||
@@ -590,6 +590,20 @@ class User extends Base {
|
||||
} else if (status === 'failure') {
|
||||
builder.where('executions.status', 'failure');
|
||||
}
|
||||
|
||||
if (startDateTime && endDateTime) {
|
||||
const startDate = DateTime.fromMillis(Number(startDateTime));
|
||||
|
||||
if (startDate.isValid) {
|
||||
builder.where('executions.created_at', '>=', startDate.toISO());
|
||||
}
|
||||
|
||||
const endDate = DateTime.fromMillis(Number(endDateTime));
|
||||
|
||||
if (endDate.isValid) {
|
||||
builder.where('executions.created_at', '<=', endDate.toISO());
|
||||
}
|
||||
}
|
||||
})
|
||||
.orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user