temp
This commit is contained in:
@@ -102,4 +102,28 @@ export async function getActiveCitizenship(userId: string) {
|
||||
return prisma.citizenship.findFirst({
|
||||
where: { userId, revokedAt: null },
|
||||
});
|
||||
}
|
||||
|
||||
// Used by the acts appointment picker - only active citizens are eligible
|
||||
// to hold a position.
|
||||
export async function searchActiveCitizenships(query: string) {
|
||||
const q = query.trim();
|
||||
if (!q) return [];
|
||||
|
||||
return prisma.citizenship.findMany({
|
||||
where: {
|
||||
revokedAt: null,
|
||||
user: {
|
||||
OR: [
|
||||
{ firstName: { contains: q, mode: "insensitive" } },
|
||||
{ secondName: { contains: q, mode: "insensitive" } },
|
||||
],
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
user: { select: { firstName: true, secondName: true } },
|
||||
},
|
||||
take: 10,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user