|
|
@ -59,7 +59,7 @@ export class UploadRoute extends Route {
|
|
|
|
this.router.use(fileUpload());
|
|
|
|
this.router.use(fileUpload());
|
|
|
|
// Uploads a file to the data directory and returns the filename
|
|
|
|
// Uploads a file to the data directory and returns the filename
|
|
|
|
this.router.use(async (req, res) => {
|
|
|
|
this.router.use(async (req, res) => {
|
|
|
|
let uploadConfirmation: UploadConfirmation;
|
|
|
|
let uploadConfirmation: IUploadConfirmation;
|
|
|
|
if (req.session.userId) {
|
|
|
|
if (req.session.userId) {
|
|
|
|
if (req.files.profilePicture) {
|
|
|
|
if (req.files.profilePicture) {
|
|
|
|
uploadConfirmation = await this.uploadProfilePicture(req);
|
|
|
|
uploadConfirmation = await this.uploadProfilePicture(req);
|
|
|
@ -94,7 +94,7 @@ export class UploadRoute extends Route {
|
|
|
|
* The user gets updated with the new profile picture url.
|
|
|
|
* The user gets updated with the new profile picture url.
|
|
|
|
* @param request
|
|
|
|
* @param request
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private async uploadProfilePicture(request: any): Promise<UploadConfirmation> {
|
|
|
|
private async uploadProfilePicture(request: any): Promise<IUploadConfirmation> {
|
|
|
|
let success = false;
|
|
|
|
let success = false;
|
|
|
|
let error: string;
|
|
|
|
let error: string;
|
|
|
|
let fileName: string;
|
|
|
|
let fileName: string;
|
|
|
|