@powerhousedao/vetra-builder-package 0.0.22 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -135,15 +135,38 @@ export const getResolvers = (subgraph) => {
|
|
|
135
135
|
members: [], // Will be resolved by field resolver
|
|
136
136
|
}));
|
|
137
137
|
},
|
|
138
|
-
fetchBuilderTeam: async (parent, args) => {
|
|
138
|
+
fetchBuilderTeam: async (parent, args, context) => {
|
|
139
139
|
const driveId = args.driveId || DEFAULT_DRIVE_ID;
|
|
140
|
-
|
|
140
|
+
context.driveId = driveId;
|
|
141
|
+
// Require either id or slug
|
|
142
|
+
if (!args.id && !args.slug) {
|
|
143
|
+
throw new Error("Either id or slug parameter is required");
|
|
144
|
+
}
|
|
145
|
+
let query = VetraBuilderRelationalDbProcessor.query(driveId, db)
|
|
141
146
|
.selectFrom("builder_teams")
|
|
142
|
-
.
|
|
147
|
+
.select([
|
|
148
|
+
"builder_teams.id",
|
|
149
|
+
"builder_teams.profile_name",
|
|
150
|
+
"builder_teams.profile_slug",
|
|
151
|
+
"builder_teams.profile_logo",
|
|
152
|
+
"builder_teams.profile_description",
|
|
153
|
+
"builder_teams.profile_socials_x",
|
|
154
|
+
"builder_teams.profile_socials_github",
|
|
155
|
+
"builder_teams.profile_socials_website",
|
|
156
|
+
"builder_teams.created_at",
|
|
157
|
+
"builder_teams.updated_at",
|
|
158
|
+
])
|
|
143
159
|
.leftJoin("deleted_files", (join) => join
|
|
144
160
|
.onRef("deleted_files.document_id", "=", "builder_teams.id")
|
|
145
|
-
.on("deleted_files.drive_id", "=", driveId))
|
|
146
|
-
|
|
161
|
+
.on("deleted_files.drive_id", "=", driveId));
|
|
162
|
+
// Query by id or slug
|
|
163
|
+
if (args.id) {
|
|
164
|
+
query = query.where("builder_teams.id", "=", args.id);
|
|
165
|
+
}
|
|
166
|
+
else if (args.slug) {
|
|
167
|
+
query = query.where("builder_teams.profile_slug", "=", args.slug);
|
|
168
|
+
}
|
|
169
|
+
const account = await query
|
|
147
170
|
.where("deleted_files.id", "is", null) // Exclude deleted documents
|
|
148
171
|
.executeTakeFirst();
|
|
149
172
|
if (!account) {
|
|
@@ -161,6 +184,8 @@ export const getResolvers = (subgraph) => {
|
|
|
161
184
|
createdAt: account.created_at.toISOString(),
|
|
162
185
|
updatedAt: account.updated_at.toISOString(),
|
|
163
186
|
driveId: driveId, // Pass driveId to field resolvers
|
|
187
|
+
spaces: [], // Will be resolved by field resolver
|
|
188
|
+
members: [], // Will be resolved by field resolver
|
|
164
189
|
};
|
|
165
190
|
},
|
|
166
191
|
},
|