@powerhousedao/vetra-builder-package 0.0.23 → 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.
|
@@ -138,13 +138,35 @@ export const getResolvers = (subgraph) => {
|
|
|
138
138
|
fetchBuilderTeam: async (parent, args, context) => {
|
|
139
139
|
const driveId = args.driveId || DEFAULT_DRIVE_ID;
|
|
140
140
|
context.driveId = driveId;
|
|
141
|
-
|
|
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)
|
|
142
146
|
.selectFrom("builder_teams")
|
|
143
|
-
.
|
|
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
|
+
])
|
|
144
159
|
.leftJoin("deleted_files", (join) => join
|
|
145
160
|
.onRef("deleted_files.document_id", "=", "builder_teams.id")
|
|
146
|
-
.on("deleted_files.drive_id", "=", driveId))
|
|
147
|
-
|
|
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
|
|
148
170
|
.where("deleted_files.id", "is", null) // Exclude deleted documents
|
|
149
171
|
.executeTakeFirst();
|
|
150
172
|
if (!account) {
|