|
|
|
@ -452,15 +452,12 @@ async function populateMeta(base: Base, project: Project): Promise<any> {
|
|
|
|
|
return info; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export async function projectInfoGet(req, res) { |
|
|
|
|
const project = await Project.getWithInfo(req.params.projectId); |
|
|
|
|
export async function projectInfoGet(_req, res) { |
|
|
|
|
res.json({ |
|
|
|
|
Node: process.version, |
|
|
|
|
Arch: process.arch, |
|
|
|
|
Platform: process.platform, |
|
|
|
|
Docker: isDocker(), |
|
|
|
|
Database: project.bases?.[0]?.type, |
|
|
|
|
ProjectOnRootDB: !!project?.is_meta, |
|
|
|
|
RootDB: Noco.getConfig()?.meta?.db?.client, |
|
|
|
|
PackageVersion: packageVersion, |
|
|
|
|
}); |
|
|
|
@ -469,7 +466,9 @@ export async function projectInfoGet(req, res) {
|
|
|
|
|
export async function projectCost(req, res) { |
|
|
|
|
let cost = 0; |
|
|
|
|
const project = await Project.getWithInfo(req.params.projectId); |
|
|
|
|
const sqlClient = NcConnectionMgrv2.getSqlClient(project.bases[0]); |
|
|
|
|
|
|
|
|
|
for (const base of project.bases) { |
|
|
|
|
const sqlClient = NcConnectionMgrv2.getSqlClient(base); |
|
|
|
|
const userCount = await ProjectUser.getUsersCount(req.query); |
|
|
|
|
const recordCount = (await sqlClient.totalRecords())?.data.TotalRecords; |
|
|
|
|
|
|
|
|
@ -486,6 +485,7 @@ export async function projectCost(req, res) {
|
|
|
|
|
// $120/user/yr
|
|
|
|
|
cost = Math.min(120 * userCount, 36000); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Tele.event({ |
|
|
|
|
event: 'a:project:cost', |
|
|
|
|