MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / adminGetOrganizations

Function adminGetOrganizations

apps/webapp/app/models/admin.server.ts:101–197  ·  view source on GitHub ↗
(userId: string, { page, search }: SearchParams)

Source from the content-addressed store, hash-verified

99}
100
101export async function adminGetOrganizations(userId: string, { page, search }: SearchParams) {
102 page = page || 1;
103
104 search = search ? decodeURIComponent(search) : undefined;
105
106 const user = await prisma.user.findUnique({
107 where: {
108 id: userId,
109 },
110 });
111
112 if (user?.admin !== true) {
113 throw new Error("Unauthorized");
114 }
115
116 const organizations = await prisma.organization.findMany({
117 select: {
118 id: true,
119 slug: true,
120 title: true,
121 v3Enabled: true,
122 members: {
123 select: {
124 user: {
125 select: {
126 email: true,
127 },
128 },
129 },
130 },
131 },
132 where: search
133 ? {
134 OR: [
135 {
136 members: {
137 some: {
138 user: {
139 name: {
140 contains: search,
141 mode: "insensitive",
142 },
143 },
144 },
145 },
146 },
147 {
148 members: {
149 some: {
150 user: {
151 email: {
152 contains: search,
153 mode: "insensitive",
154 },
155 },
156 },
157 },
158 },

Callers 1

loaderFunction · 0.90

Calls 1

countMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…