feat: implement complex selection flow
This commit is contained in:
@@ -104,7 +104,52 @@ export async function listMyComplexes(userId: string) {
|
||||
},
|
||||
});
|
||||
|
||||
return complexUsers.map((complexUser) => complexUser.complex);
|
||||
return complexUsers.map((complexUser) => ({
|
||||
...complexUser.complex,
|
||||
role: complexUser.role,
|
||||
}));
|
||||
}
|
||||
|
||||
export async function getCurrentComplex(userId: string, complexId: string) {
|
||||
const complexUser = await db.complexUser.findUnique({
|
||||
where: {
|
||||
complexId_userId: {
|
||||
complexId,
|
||||
userId,
|
||||
},
|
||||
},
|
||||
include: {
|
||||
complex: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!complexUser) return null;
|
||||
|
||||
return {
|
||||
...complexUser.complex,
|
||||
role: complexUser.role,
|
||||
};
|
||||
}
|
||||
|
||||
export async function selectComplex(userId: string, complexId: string) {
|
||||
const complexUser = await db.complexUser.findUnique({
|
||||
where: {
|
||||
complexId_userId: {
|
||||
complexId,
|
||||
userId,
|
||||
},
|
||||
},
|
||||
include: {
|
||||
complex: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!complexUser) return null;
|
||||
|
||||
return {
|
||||
...complexUser.complex,
|
||||
role: complexUser.role,
|
||||
};
|
||||
}
|
||||
|
||||
export async function updateComplex(id: string, input: UpdateComplexInput) {
|
||||
|
||||
Reference in New Issue
Block a user