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