perf: migrate listHandler to AttributeRepository + cache attributes fetching in RSCs (#21552)
* refactor: migrate listHandler to AttributeRepository Co-Authored-By: [email protected] <[email protected]> * cache attributes list --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]> Co-authored-by: hbjORbj <[email protected]>
This commit is contained in:
7 files changed
+39
-41
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import prisma from "@calcom/prisma";
|
||||
import { AttributeRepository } from "@calcom/lib/server/repository/attribute";
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
||||
@@ -20,14 +20,7 @@ const listHandler = async (opts: GetOptions) => {
|
||||
});
|
||||
}
|
||||
|
||||
return await prisma.attribute.findMany({
|
||||
where: {
|
||||
teamId: org.id,
|
||||
},
|
||||
include: {
|
||||
options: true,
|
||||
},
|
||||
});
|
||||
return await AttributeRepository.findAllByOrgIdWithOptions({ orgId: org.id });
|
||||
};
|
||||
|
||||
export default listHandler;
|
||||
Reference in new issue
Block a user