added user controller and modified auth method page

This commit is contained in:
Sheen Capadngan
2023-08-06 19:09:38 +08:00
parent 49bcd8839f
commit 5604232aea
8 changed files with 123 additions and 47 deletions
+18
View File
@@ -57,6 +57,24 @@ router.patch(
usersController.updateAuthProvider
);
router.put(
"/me/auth-providers",
requireAuth({
acceptedAuthModes: [AUTH_MODE_JWT, AUTH_MODE_API_KEY],
}),
body("authProviders").exists().isArray({
min: 1,
}).custom((authProviders: AuthProvider[]) => {
return authProviders.every(provider => [
AuthProvider.EMAIL,
AuthProvider.GOOGLE,
AuthProvider.GITHUB
].includes(provider))
}),
validateRequest,
usersController.updateAuthProviders,
);
router.get(
"/me/organizations",
requireAuth({