-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Logout feature (#26) * [#187584914]added logout feature * [starts #187584914] added logout feature * [finishes#187584914] logout feature * [delivers##187584914] updated readme & swagger.json * [delivers##187584914] updated readme & swagger.json * [deliveres #187584914] logout features completed * [deliveres #187584914] logout features completed * [delivers #187584914] finished logout feature * fixing bugs * rebased --------- Co-authored-by: Solange Duhimbaze Ihirwe <[email protected]>
- Loading branch information
1 parent
c0fbf6f
commit 3986393
Showing
15 changed files
with
505 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
// import { Request } from "express"; | ||
// import multer from "multer"; | ||
// import path from "path"; | ||
import { Request } from "express"; | ||
import multer from "multer"; | ||
import path from "path"; | ||
|
||
// export default multer({ | ||
// storage:multer.diskStorage({}), | ||
// fileFilter:(req:Request,file:Express.Multer.File,cb)=>{ | ||
// const ext = path.extname(file.originalname); | ||
// if(ext!== ".png" && ext!== ".jpg" && ext!== ".jpeg"){ | ||
// return cb(new Error("Only images are allowed")); | ||
// } | ||
// cb(null,true); | ||
// } | ||
// }) | ||
export default multer({ | ||
storage:multer.diskStorage({}), | ||
fileFilter:(req:Request,file:Express.Multer.File,cb)=>{ | ||
const ext = path.extname(file.originalname); | ||
if(ext!== ".png" && ext!== ".jpg" && ext!== ".jpeg"){ | ||
return cb(new Error("Only images are allowed")); | ||
} | ||
cb(null,true); | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
// /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
// import { v2 as cloudinary } from "cloudinary"; | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import { v2 as cloudinary } from "cloudinary"; | ||
|
||
// cloudinary.config({ | ||
// cloud_name: process.env.CLOUD_NAME, | ||
// api_key: process.env.API_KEY, | ||
// api_secret: process.env.API_SECRET | ||
// }); | ||
cloudinary.config({ | ||
cloud_name: process.env.CLOUD_NAME, | ||
api_key: process.env.API_KEY, | ||
api_secret: process.env.API_SECRET | ||
}); | ||
|
||
// export const uploadImages = async (fileToUpload: any): Promise<{ public_id: string; secure_url: string }> => { | ||
// const result = await cloudinary.uploader.upload(fileToUpload.path); | ||
// return { | ||
// public_id: result.public_id, | ||
// secure_url: result.secure_url | ||
// }; | ||
// }; | ||
export const uploadImages = async (fileToUpload: any): Promise<{ public_id: string; secure_url: string }> => { | ||
const result = await cloudinary.uploader.upload(fileToUpload.path); | ||
return { | ||
public_id: result.public_id, | ||
secure_url: result.secure_url | ||
}; | ||
}; | ||
|
||
// export default uploadImages; | ||
export default uploadImages; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import Users from "../../../databases/models/users"; | ||
|
||
|
||
const getAllUsers = async () => { | ||
return Users.findAll(); | ||
} | ||
|
||
const getUserById = async (id: number) => { | ||
return Users.findByPk(id); | ||
const updateUserProfile = async (user: any, id:number) => { | ||
await Users.update({...user},{where:{id},returning:true}) | ||
const updateUser = await Users.findOne({where:{id}}) | ||
return updateUser; | ||
} | ||
|
||
export default { getAllUsers, getUserById} | ||
export default { getAllUsers,updateUserProfile} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.