zhaoyingbo 18a95387ee
All checks were successful
CI Monitor CI/CD / build-image (push) Successful in 33s
CI Monitor CI/CD / deploy (push) Successful in 37s
chore: 更新lint-staged和commitlint配置
2024-07-25 01:09:24 +00:00

39 lines
1.0 KiB
TypeScript

import { DB } from "../../types/db"
import { managePb404 } from "../../utils/pbTools"
import pbClient from "../pbClient"
/**
* 根据给定的周来检索完整的统计信息。
* @param week - 需要检索统计信息的周。
* @returns 一个解析为指定周的完整统计信息的promise。
*/
const getFullStatisticsByWeek = (week: string) => {
return managePb404<DB.StatisticsPerWeek>(
async () =>
await pbClient
.collection("statisticsPerWeek")
.getFirstListItem(`week="${week}"`)
)
}
/**
* 根据给定的周来检索项目统计信息。
* @param week - 需要检索统计信息的周。
* @returns 一个解析为指定周的项目统计信息数组的promise。
*/
const getProjStatisticsByWeek = (week: string) => {
return managePb404<DB.StatisticsPerProj[]>(
async () =>
await pbClient
.collection("statisticsPerProj")
.getFullList({ filter: `week="${week}"` })
)
}
const view = {
getFullStatisticsByWeek,
getProjStatisticsByWeek,
}
export default view