(websiteId: string)
| 49 | } |
| 50 | |
| 51 | export async function getWorkspaceWebsiteDateRange(websiteId: string) { |
| 52 | const { params } = await parseWebsiteFilters(websiteId, { |
| 53 | startDate: new Date(DEFAULT_RESET_DATE), |
| 54 | }); |
| 55 | |
| 56 | const res = await prisma.websiteEvent.aggregate({ |
| 57 | _max: { |
| 58 | createdAt: true, |
| 59 | }, |
| 60 | _min: { |
| 61 | createdAt: true, |
| 62 | }, |
| 63 | where: { |
| 64 | websiteId, |
| 65 | createdAt: { |
| 66 | gt: params.startDate, |
| 67 | }, |
| 68 | }, |
| 69 | }); |
| 70 | |
| 71 | return { |
| 72 | max: res._max.createdAt, |
| 73 | min: res._min.createdAt, |
| 74 | }; |
| 75 | } |
| 76 | |
| 77 | export async function getWorkspaceServiceCount(workspaceId: string) { |
| 78 | const [ |
no test coverage detected