All checks were successful
CI Monitor MIflow / build-image (push) Successful in 45s
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { DB } from "../../types/db"
|
|
import { managePb404 } from "../../utils/pbTools"
|
|
import pbClient from "../pbClient"
|
|
|
|
/**
|
|
* 根据给定的周来检索完整的统计信息。
|
|
* @param {string} week - 需要检索统计信息的周。
|
|
* @returns {Promise<DB.StatisticsPerWeek | null>} - 一个解析为指定周的完整统计信息的promise。
|
|
*/
|
|
const getFullStatisticsByWeek = (week: string) =>
|
|
managePb404<DB.StatisticsPerWeek>(() =>
|
|
pbClient.collection("statisticsPerWeek").getFirstListItem(`week="${week}"`)
|
|
)
|
|
|
|
/**
|
|
* 根据给定的周来检索项目统计信息。
|
|
* @param {string} week - 需要检索统计信息的周。
|
|
* @returns {Promise<DB.StatisticsPerProj[] | null>} - 一个解析为指定周的项目统计信息数组的promise。
|
|
*/
|
|
const getProjStatisticsByWeek = (week: string) =>
|
|
managePb404<DB.StatisticsPerProj[]>(() =>
|
|
pbClient
|
|
.collection("statisticsPerProj")
|
|
.getFullList({ filter: `week="${week}"` })
|
|
)
|
|
|
|
/**
|
|
* 提供与视图相关的数据库操作。
|
|
*/
|
|
const view = {
|
|
getFullStatisticsByWeek,
|
|
getProjStatisticsByWeek,
|
|
}
|
|
|
|
export default view
|