Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
refacto(community.ts): add community router (#2336)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasCharrier authored Jan 15, 2024
1 parent f1fbaed commit 7b9fe04
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 30 deletions.
1 change: 0 additions & 1 deletion src/config/email.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import {
AddContactsToMailingLists,
GetAllContacts,
Expand Down
8 changes: 2 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import path from 'path';
import cors from 'cors';
import config from '@config';
import * as adminController from '@/controllers/adminController';
import * as communityController from '@controllers/communityController';
import * as githubNotificationController from '@controllers/githubNotificationController';
import * as indexController from '@controllers/indexController';
import * as loginController from '@controllers/loginController';
Expand Down Expand Up @@ -42,6 +41,7 @@ import { userRouter, userApiRouter, userPublicApiRouter } from './routes/users';
import { marrainageRouter } from './routes/marrainage';
import { accountRouter } from './routes/account';
import { startupRouter } from './routes/startups';
import { communityRouter } from './routes/community';

export const app = express();
app.set('trust proxy', 1);
Expand Down Expand Up @@ -236,6 +236,7 @@ app.use(userPublicApiRouter);
app.use(marrainageRouter);
app.use(accountRouter);
app.use(startupRouter);
app.use(communityRouter);

// que ce passe-t-il
app.get(
Expand Down Expand Up @@ -278,11 +279,6 @@ app.put(
updateBadgeRenewalRequestStatus
);

app.get(routes.GET_COMMUNITY, communityController.getCommunity);
app.get(routes.GET_COMMUNITY_API, communityController.getCommunityApi);
app.get(routes.GET_USER, communityController.getUser);
app.get(routes.GET_USER_API, communityController.getUserApi);

app.get(routes.ADMIN, adminController.getEmailLists);

// INCUBTORS
Expand Down
1 change: 1 addition & 0 deletions src/infra/email/sendInBlue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ export async function removeContactsFromMailingList({

export async function getContactInfo({ email }: { email: string }) {
let apiInstance = new SibApiV3Sdk.ContactsApi();

const data = apiInstance.getContactInfo(email).then(
function (data) {
return data;
Expand Down
46 changes: 23 additions & 23 deletions src/lib/mattermost/index.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
import { getMattermostConfig } from "@/config/mattermost/mattermost.config";
import { getMattermostConfig } from '@/config/mattermost/mattermost.config';
import config from '@config';
import axios from 'axios';

export interface MattermostUser {
id: string,
create_at: number,
update_at: number,
delete_at: number,
username: string,
first_name: string,
last_name: string,
nickname: string,
email: string,
email_verified: boolean,
auth_service: string,
roles: string,
locale: string,
mfa_active: boolean,
last_activity_at: string,
id: string;
create_at: number;
update_at: number;
delete_at: number;
username: string;
first_name: string;
last_name: string;
nickname: string;
email: string;
email_verified: boolean;
auth_service: string;
roles: string;
locale: string;
mfa_active: boolean;
last_activity_at: string;
}

export interface MattermostChannel {
name: string,
display_name: string,
purpose: string,
header: string,
last_post_at: string,
total_msg_count: string
name: string;
display_name: string;
purpose: string;
header: string;
last_post_at: string;
total_msg_count: string;
}

export async function getUserWithParams(params = {}, i = 0) {
const mattermostUsers = await axios
.get(`${config.mattermostURL}/api/v4/users?per_page=200&page=${i}`, {
params: {
...params
...params,
},
...getMattermostConfig(),
})
Expand Down
12 changes: 12 additions & 0 deletions src/routes/community.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import express from 'express';
import * as communityController from '@controllers/communityController';
import routes from './routes';

const router = express.Router();

router.get(routes.GET_COMMUNITY, communityController.getCommunity);
router.get(routes.GET_COMMUNITY_API, communityController.getCommunityApi);
router.get(routes.GET_USER, communityController.getUser);
router.get(routes.GET_USER_API, communityController.getUserApi);

export { router as communityRouter };

0 comments on commit 7b9fe04

Please sign in to comment.