|
| 1 | +# BDPA NHSCC 2021 Problem Statement (part 2) |
| 2 | + |
| 3 | +> See also: [API documentation](https://hscc6xt8cqqf.docs.apiary.io) |
| 4 | +
|
| 5 | +Ghost, Inc. applauds the successful rollout of their "secret" messaging app! |
| 6 | +Feedback indicates users are satisfied with your app UX and performance data |
| 7 | +shows response time tail latencies are very low. But your contractor has |
| 8 | +identified some changes they want implemented. |
| 9 | + |
| 10 | +> We're looking for feedback! If you have any opinions or ideas, |
| 11 | +> [start a discussion](https://github.com/nhscc/problem-statements/discussions/new). |
| 12 | +
|
| 13 | +> All uploaded images can be viewed [here](https://imgur.com/a/TytqlvJ). |
| 14 | +
|
| 15 | +There are ten (10) changes in total. Three (3) ✨changes✨ are worth more points |
| 16 | +than the others: |
| 17 | + |
| 18 | +## ✨Change 1✨ |
| 19 | + |
| 20 | +**Image file storage has been offloaded to the new API v1.1.0.** |
| 21 | + |
| 22 | +A new version of the Ghostmeme API is available: version v1.1.0 🎉. This |
| 23 | +backwards-compatible update officially allows the |
| 24 | +[`POST /memes`](https://hscc6xt8cqqf.docs.apiary.io/#/reference/0/meme-endpoints/memes-post), |
| 25 | +[`POST /users`](https://hscc6xt8cqqf.docs.apiary.io/#/reference/0/user-endpoints/users-post), |
| 26 | +and |
| 27 | +[`PUT /users/:user_id`](https://hscc6xt8cqqf.docs.apiary.io/#/reference/0/user-endpoints/users-user-id-put) |
| 28 | +endpoints to recognize the `imageBase64` parameter. This parameter takes a |
| 29 | +[base64-encoded string](https://stackoverflow.com/questions/10315757/what-is-the-real-purpose-of-base64-encoding) |
| 30 | +representing an image file. |
| 31 | + |
| 32 | +Previously, profile image files were stored locally. **With API v1.1.0, your app |
| 33 | +is no longer allowed to store _any_ uploaded image files locally.** In this way, |
| 34 | +the API becomes the single source of truth for all non-static images in the app. |
| 35 | + |
| 36 | +Going forward, user profile image urls must be retrieved from the API using |
| 37 | +[`GET /users/:user_id`](https://hscc6xt8cqqf.docs.apiary.io/#/reference/0/user-endpoints/users-user-id-get) |
| 38 | +and the newly recognized |
| 39 | +[`imageUrl`](https://hscc6xt8cqqf.docs.apiary.io/#/data-structures/0/user) |
| 40 | +property. Retrieving meme image urls via the |
| 41 | +[`imageUrl`](https://hscc6xt8cqqf.docs.apiary.io/#/data-structures/0/meme) |
| 42 | +property has not changed. |
| 43 | + |
| 44 | +> Note that API requests are limited to 10MB, including image uploads. Base64 |
| 45 | +> can bloat an image file's size by up to 33%, so plan your app's upload limits |
| 46 | +> accordingly. |
| 47 | +
|
| 48 | +> Teams' solutions not using the API to store and retrieve profile images or |
| 49 | +> meme files will earn zero points from this and other changes. |
| 50 | +
|
| 51 | +## ✨Change 2✨ |
| 52 | + |
| 53 | +**Authed users can upload image files directly when creating memes and choosing |
| 54 | +profile images.** |
| 55 | + |
| 56 | +Previously, users could only "upload" meme images by copying and pasting URLs. |
| 57 | +With this change, users will have a second option: actually uploading their |
| 58 | +image file directly from their PC. When an image is uploaded, the app must send |
| 59 | +it to the API to be stored. This can be accomplished using the newly recognized |
| 60 | +`imageBase64` parameter on the |
| 61 | +[`POST /memes`](https://hscc6xt8cqqf.docs.apiary.io/#/reference/0/meme-endpoints/memes-post) |
| 62 | +endpoint. |
| 63 | + |
| 64 | +On the other hand, profile image files were already uploaded to your app, but |
| 65 | +they weren't globally available across teams' solutions. With this change, user |
| 66 | +profile images are now uploaded to the API **exclusively** via the `imageBase64` |
| 67 | +parameter on the |
| 68 | +[`POST /users`](https://hscc6xt8cqqf.docs.apiary.io/#/reference/0/user-endpoints/users-post) |
| 69 | +and |
| 70 | +[`PUT /users/:user_id`](https://hscc6xt8cqqf.docs.apiary.io/#/reference/0/user-endpoints/users-user-id-put) |
| 71 | +endpoints. Your app is no longer allowed to store any uploaded images locally |
| 72 | +(unless caching). |
| 73 | + |
| 74 | +[Here is a JavaScript example](https://jsbin.com/piqiqecuxo/1/edit?js,console,output) |
| 75 | +that 1) allows a user to select an image file and then 2) transforms that file |
| 76 | +into a |
| 77 | +[base64-encoded](https://stackoverflow.com/questions/10315757/what-is-the-real-purpose-of-base64-encoding) |
| 78 | +[data URI](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) |
| 79 | +string. This is the string your app will upload to the API via the `imageBase64` |
| 80 | +parameter described above. All images uploaded to the API can be viewed |
| 81 | +[here](https://imgur.com/a/TytqlvJ). |
| 82 | + |
| 83 | +## Change 3 |
| 84 | + |
| 85 | +**Authed users can change their account information and credentials.** |
| 86 | + |
| 87 | +With this change, it is required that users can update their password, profile |
| 88 | +picture, email, and/or phone number. Previously, this was not required |
| 89 | +functionality. |
| 90 | + |
| 91 | +A user must re-authorize with their password before being allowed to change |
| 92 | +their account information or credentials. |
| 93 | + |
| 94 | +Additionally, profile pictures are now optional for users and are no longer |
| 95 | +required at registration. |
| 96 | + |
| 97 | +## Change 4 |
| 98 | + |
| 99 | +**New toggleable website theme: dark mode.** |
| 100 | + |
| 101 | +> Or, if your app UI already uses light text on a dark background, it needs a |
| 102 | +> _light mode_! |
| 103 | +
|
| 104 | +The users have spoken and they want the ability to |
| 105 | +[toggle the website to a dark version of itself](https://codepen.io/adhuham/pen/GRJxpQr), |
| 106 | +dubbed _dark mode_. While the UI normally features blackish text on a bright |
| 107 | +background, when in dark mode the UI will render white text on a dark |
| 108 | +background. |
| 109 | + |
| 110 | +## Change 5 |
| 111 | + |
| 112 | +**Hashtags are displayed along with their trend data.** |
| 113 | + |
| 114 | +With this change, the app will start tracking the most frequently used hashtags |
| 115 | +in the system and rank them with the most popular most used hashtag being "rank |
| 116 | +1" and the least used hashtag "rank N" (of N). A hashtag's rank will be rendered |
| 117 | +in the UI next to its text. |
| 118 | + |
| 119 | +For example, suppose the hashtag `#MyTag` is the 5492th most used hashtag in the |
| 120 | +system. When used in a meme description or comment, it could appear in the UI |
| 121 | +looking something like the following: |
| 122 | + |
| 123 | +> Blah blah witty comment. [**#MyTag** `5492`](#change-5) plus some more comment |
| 124 | +> text. |
| 125 | +
|
| 126 | +## ✨Change 6✨ |
| 127 | + |
| 128 | +**New Spotlight view: interact with _public_ memes and trending hashtags.** |
| 129 | + |
| 130 | +Up until this point, memes have been created as |
| 131 | +[`private`](https://hscc6xt8cqqf.docs.apiary.io/#/data-structures/0/user)`== true`. |
| 132 | +With this change, users now have the option to share memes _publicly_ in |
| 133 | +addition to stories and chats. These public memes are listed in a new _Spotlight |
| 134 | +view_ where both `authed` (logged in) and `guest` (not logged in) users can view |
| 135 | +them. Only `authed` users can like or share public memes from this view. Unlike |
| 136 | +memes shared to the Stories view, users _cannot_ comment on memes in the |
| 137 | +Spotlight view; these memes can only be viewed and—by `authed` users—liked, |
| 138 | +unliked, and shared to their user story. |
| 139 | + |
| 140 | +At the top of the UI, the Spotlight view will show |
| 141 | +[the top five trending hashtags in the system along with their trend data](#change-5). |
| 142 | +Below that, a paginated list of the "most likable" publicly-shared memes in the |
| 143 | +system is shown. Use or devise any reasonable algorithm to achieve this. |
| 144 | + |
| 145 | +<blockquote> |
| 146 | + |
| 147 | +Meme objects created for this view must have _null_ |
| 148 | +[`receiver`](https://hscc6xt8cqqf.docs.apiary.io/#/data-structures/0/meme) and |
| 149 | +[`replyTo`](https://hscc6xt8cqqf.docs.apiary.io/#/data-structures/0/meme) |
| 150 | +properties and a _false_ |
| 151 | +[`private`](https://hscc6xt8cqqf.docs.apiary.io/#/data-structures/0/user) |
| 152 | +property. This is the difference between public meme objects displayed in the |
| 153 | +Spotlight view and private meme objects meant for display in other views. |
| 154 | + |
| 155 | +</blockquote> |
| 156 | + |
| 157 | +## Change 7 |
| 158 | + |
| 159 | +**Authed users can send memes to multiple recipients at once.** |
| 160 | + |
| 161 | +Previously, users could send a meme via a |
| 162 | +[chat](https://github.com/nhscc/problem-statements/blob/main/2021/ghostmeme/ghostmeme-part-1.md#requirement-2) |
| 163 | +with another user. With this change, users now have the UI option to send a |
| 164 | +single meme to one _or more_ chats all at once instead of having to send it to |
| 165 | +each user one by one. |
| 166 | + |
| 167 | +## Change 8 |
| 168 | + |
| 169 | +**Authed users are notified when unread memes they've received are about to |
| 170 | +vanish.** |
| 171 | + |
| 172 | +With this change, the user will receive a |
| 173 | +[notification](https://github.com/nhscc/problem-statements/blob/main/2021/ghostmeme/ghostmeme-part-1.md#requirement-4) |
| 174 | +when a meme |
| 175 | +[they were sent by another user](https://github.com/nhscc/problem-statements/blob/main/2021/ghostmeme/ghostmeme-part-1.md#requirement-2) |
| 176 | +is one (1) minute or less away from |
| 177 | +[vanishing](https://github.com/nhscc/problem-statements/blob/main/2021/ghostmeme/ghostmeme-part-1.md#vanishing-memes) |
| 178 | +and has not been viewed yet using your app. Once the meme vanishes, this |
| 179 | +notification should be deleted. |
| 180 | + |
| 181 | +## Change 9 |
| 182 | + |
| 183 | +**Authed users can block and unblock other users.** |
| 184 | + |
| 185 | +With this change, when a user sees a meme they don't like, they have the option |
| 186 | +to **block** the user that created it. Blocked users' memes, chats, and comments |
| 187 | +are never shown to the user that blocked them and vice-versa. Blocking a friend |
| 188 | +automatically unfriends them. Friend requests from blocked users are silently |
| 189 | +discarded. |
| 190 | + |
| 191 | +There will be a way for the user to see a list of the users they've blocked and |
| 192 | +to selectively unblock them. The ability to scroll a list of blocked users and |
| 193 | +unblock some of them can be merged into an existing view if appropriate. |
| 194 | + |
| 195 | +> The API does not store data on which users block which others. That is the |
| 196 | +> responsibility of each individual team's solution. |
| 197 | +
|
| 198 | +## Change 10 |
| 199 | + |
| 200 | +**Authed users are notified when security events occur.** |
| 201 | + |
| 202 | +The app will now keep track of security events and generate |
| 203 | +[notifications](https://github.com/nhscc/problem-statements/blob/main/2021/ghostmeme/ghostmeme-part-1.md#requirement-4) |
| 204 | +when they occur. |
| 205 | + |
| 206 | +Security events include: |
| 207 | + |
| 208 | +- When the user logs in and from which IP address |
| 209 | +- When the user changes their email, phone number, profile picture, or password |
| 210 | + |
| 211 | +With this change, the user will receive a |
| 212 | +[notification](https://github.com/nhscc/problem-statements/blob/main/2021/ghostmeme/ghostmeme-part-1.md#requirement-4) |
| 213 | +when one of these security events occur. |
0 commit comments