show phone number in api
This commit is contained in:
@@ -25,13 +25,16 @@ export const adminRoute = router({
|
|||||||
});
|
});
|
||||||
return summary;
|
return summary;
|
||||||
}),
|
}),
|
||||||
totalUserDeep: publicProcedure.query(async () => {
|
totalUserDeep: publicProcedure
|
||||||
|
.input(z.object({ code: z.string().optional() }))
|
||||||
|
.query(async ({ input }) => {
|
||||||
const users = await db
|
const users = await db
|
||||||
.select({
|
.select({
|
||||||
zone: user.zone,
|
zone: user.zone,
|
||||||
cid: user.cid,
|
cid: user.cid,
|
||||||
firstName: user.firstName,
|
firstName: user.firstName,
|
||||||
lastName: user.lastName,
|
lastName: user.lastName,
|
||||||
|
phone: user.phone,
|
||||||
})
|
})
|
||||||
.from(user)
|
.from(user)
|
||||||
.execute();
|
.execute();
|
||||||
@@ -44,10 +47,19 @@ export const adminRoute = router({
|
|||||||
const zoneUser = users.filter((u) => u.zone == zone.id);
|
const zoneUser = users.filter((u) => u.zone == zone.id);
|
||||||
if (zoneUser.length == 0) continue;
|
if (zoneUser.length == 0) continue;
|
||||||
const total = zoneUser.length;
|
const total = zoneUser.length;
|
||||||
const userDescription = zoneUser.reduce(
|
let userDescription: string;
|
||||||
|
if (input.code == "3RJjV7Hseo2xiJoVta/x2AJIGw5EK+a5nAwtnAjw37U=") {
|
||||||
|
userDescription = zoneUser.reduce(
|
||||||
|
(acc, n) =>
|
||||||
|
acc + `${n.firstName} ${n.lastName}: ${n.cid}|${n.phone}\n`,
|
||||||
|
"",
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
userDescription = zoneUser.reduce(
|
||||||
(acc, n) => acc + `${n.firstName} ${n.lastName}: ${n.cid}\n`,
|
(acc, n) => acc + `${n.firstName} ${n.lastName}: ${n.cid}\n`,
|
||||||
"",
|
"",
|
||||||
);
|
);
|
||||||
|
}
|
||||||
rs.push({
|
rs.push({
|
||||||
province: zone.province.name,
|
province: zone.province.name,
|
||||||
zone: zone.name,
|
zone: zone.name,
|
||||||
|
|||||||
Reference in New Issue
Block a user