refactor(board): delete old board routes, absorb slackHandle into profile PATCH
- Delete server/api/members/me/board.patch.js and server/api/board/suggestions.get.js - Add boardSlackHandle to memberProfileUpdateSchema; remove boardPrivacy - profile.patch.js: write boardSlackHandle -> board.slackHandle; drop boardPrivacy - Remove privacy.board field from Member model - onboarding/status.get.js: hasProfileTags now requires only craftTags; hasEngagedBoard uses BoardPost.exists - onboarding/track.post.js: graduation check uses BoardPost.exists instead of board.topics elemMatch - members/[id].get.js and directory.get.js: reduce board response to slackHandle only; drop connectionTag and peerSupport filters
This commit is contained in:
parent
6a440a846d
commit
1fc937a26a
9 changed files with 34 additions and 230 deletions
|
|
@ -22,9 +22,7 @@ export default defineEventHandler(async (event) => {
|
|||
const query = getQuery(event);
|
||||
const search = query.search || "";
|
||||
const circle = query.circle || "";
|
||||
const peerSupport = query.peerSupport || "";
|
||||
const craftTag = query.craftTag || "";
|
||||
const connectionTag = query.connectionTag || "";
|
||||
|
||||
const dbQuery = {
|
||||
showInDirectory: true,
|
||||
|
|
@ -37,10 +35,6 @@ export default defineEventHandler(async (event) => {
|
|||
|
||||
const andConditions = [];
|
||||
|
||||
if (peerSupport === "true") {
|
||||
dbQuery["board.offerPeerSupport"] = true;
|
||||
}
|
||||
|
||||
if (search) {
|
||||
const escaped = escapeRegex(search);
|
||||
andConditions.push({
|
||||
|
|
@ -55,10 +49,6 @@ export default defineEventHandler(async (event) => {
|
|||
dbQuery.craftTags = craftTag;
|
||||
}
|
||||
|
||||
if (connectionTag) {
|
||||
dbQuery["board.topics.tagSlug"] = connectionTag;
|
||||
}
|
||||
|
||||
if (andConditions.length > 0) {
|
||||
dbQuery.$and = andConditions;
|
||||
}
|
||||
|
|
@ -96,17 +86,9 @@ export default defineEventHandler(async (event) => {
|
|||
if (isVisible("socialLinks")) filtered.socialLinks = member.socialLinks;
|
||||
if (isVisible("craftTags")) filtered.craftTags = member.craftTags;
|
||||
|
||||
if (isVisible("board")) {
|
||||
const board = member.board || {};
|
||||
filtered.board = {
|
||||
topics: board.topics,
|
||||
offerPeerSupport: board.offerPeerSupport,
|
||||
availability: board.availability,
|
||||
...(board.offerPeerSupport && {
|
||||
slackHandle: board.slackHandle,
|
||||
}),
|
||||
};
|
||||
}
|
||||
filtered.board = {
|
||||
slackHandle: member.board?.slackHandle,
|
||||
};
|
||||
|
||||
return filtered;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue