Skip to content

Commit dc07e38

Browse files
authored
Merge pull request #109 from techstartucalgary/backend-social-links-other-array
Allow multiple 'other' social links on user profile
2 parents 109d3f1 + 43978b2 commit dc07e38

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎shatter-backend/docs/API_REFERENCE.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ Update a user's profile. Users can only update their own profile.
537537
| `password` | string | Minimum 8 characters |
538538
| `bio` | string | |
539539
| `profilePhoto` | string | URL |
540-
| `socialLinks` | object | `{ linkedin?, github?, other? }` |
540+
| `socialLinks` | object | `{ linkedin?: string, github?: string, other?: string[] }` — `other` replaces the whole array on update |
541541
| `organization` | string | Where the user works/studies |
542542
| `title` | string | Job title or role |
543543

@@ -831,7 +831,7 @@ Join an event as a guest (no account required).
831831
| `socialLinks` | object | No* | Social links |
832832
| `socialLinks.linkedin` | string | No | LinkedIn URL |
833833
| `socialLinks.github` | string | No | GitHub URL |
834-
| `socialLinks.other` | string | No | Other URL |
834+
| `socialLinks.other` | string[] | No | Array of additional social/profile URLs |
835835
| `organization` | string | No* | Where the guest works/studies |
836836
| `title` | string | No | Job title or role |
837837

‎shatter-backend/docs/DATABASE_SCHEMA.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
| `title` | String | No | — | Trimmed |
6868
| `bio` | String | No | — | Trimmed |
6969
| `profilePhoto` | String | No | — | |
70-
| `socialLinks` | Object | No | — | `{ linkedin?: String, github?: String, other?: String }` |
70+
| `socialLinks` | Object | No | — | `{ linkedin?: String, github?: String, other?: String[] }` — `other` is an array so users can add multiple miscellaneous links |
7171
| `authProvider` | String (enum) | Yes | `'local'` | One of: `'local'`, `'linkedin'`, `'guest'` |
7272
| `lastLogin` | Date | No | `null` | |
7373
| `passwordChangedAt`| Date | No | `null` | |

‎shatter-backend/src/controllers/event_controller.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ export async function joinEventAsGuest(req: Request, res: Response) {
277277
const { name, email, socialLinks, organization, title } = req.body as {
278278
name?: string;
279279
email?: string;
280-
socialLinks?: { linkedin?: string; github?: string; other?: string };
280+
socialLinks?: { linkedin?: string; github?: string; other?: string[] };
281281
organization?: string;
282282
title?: string;
283283
};
@@ -295,7 +295,7 @@ export async function joinEventAsGuest(req: Request, res: Response) {
295295
const hasSocialLink = socialLinks && (
296296
socialLinks.linkedin?.trim() ||
297297
socialLinks.github?.trim() ||
298-
socialLinks.other?.trim()
298+
socialLinks.other?.some((s) => s.trim())
299299
);
300300
const hasOrganization = organization && organization.trim();
301301

‎shatter-backend/src/controllers/user_controller.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export const updateUser = async (req: Request, res: Response) => {
121121
password?: string;
122122
bio?: string;
123123
profilePhoto?: string;
124-
socialLinks?: { linkedin?: string; github?: string; other?: string };
124+
socialLinks?: { linkedin?: string; github?: string; other?: string[] };
125125
organization?: string;
126126
title?: string;
127127
};

‎shatter-backend/src/models/user_model.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface IUser {
1919
socialLinks?: {
2020
linkedin?: string;
2121
github?: string;
22-
other?: string;
22+
other?: string[];
2323
};
2424
authProvider: 'local' | 'linkedin' | 'guest';
2525
lastLogin?: Date;
@@ -85,7 +85,7 @@ const UserSchema = new Schema<IUser>(
8585
socialLinks: {
8686
linkedin: { type: String },
8787
github: { type: String },
88-
other: { type: String },
88+
other: { type: [String], default: undefined },
8989
},
9090
authProvider: {
9191
type: String,

0 commit comments

Comments
 (0)