Skip to content

Commit bdcdd43

Browse files
santeri0200iritmaximus
authored andcommitted
[META] Remove toska sub- and prefixes from function names
1 parent 80e91d7 commit bdcdd43

File tree

7 files changed

+11
-27
lines changed

7 files changed

+11
-27
lines changed

services/backend/src/middleware/currentUser.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { NextFunction, Request, Response } from 'express'
33
import { intersection } from 'lodash-es'
44

55
import { requiredGroup } from '../config'
6-
import { getMockedUser, getOrganizationAccess, getUserToska } from '../services/userService'
6+
import { getMockedUser, getOrganizationAccess, getUser } from '../services/userService'
77
import { ApplicationError } from '../util/customErrors'
88
import logger from '../util/logger'
99

@@ -24,7 +24,7 @@ type Headers = {
2424
'x-show-as-user'?: string
2525
}
2626

27-
const toskaUserMiddleware = async (req: Request, _: Response, next: NextFunction) => {
27+
export default async (req: Request, _: Response, next: NextFunction) => {
2828
const {
2929
'shib-session-id': sessionId,
3030
'x-show-as-user': showAsUser,
@@ -60,7 +60,7 @@ const toskaUserMiddleware = async (req: Request, _: Response, next: NextFunction
6060
const user =
6161
showAsUser && specialGroup?.superAdmin
6262
? await getMockedUser({ userToMock: showAsUser, mockedBy: username })
63-
: await getUserToska({
63+
: await getUser({
6464
username,
6565
name: name!,
6666
email: email!,
@@ -79,5 +79,3 @@ const toskaUserMiddleware = async (req: Request, _: Response, next: NextFunction
7979

8080
next()
8181
}
82-
83-
export default toskaUserMiddleware
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import headersMiddleware from 'unfuck-utf8-headers-middleware'
22

3-
const headersToska = ['uid', 'displayName', 'shib-session-id', 'hyGroupCn', 'mail', 'hyPersonSisuId']
4-
5-
const headers = headersToska
6-
3+
const headers = ['uid', 'displayName', 'shib-session-id', 'hyGroupCn', 'mail', 'hyPersonSisuId']
74
export default headersMiddleware(headers)

services/backend/src/routes/feedback.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Request, Response, Router } from 'express'
22

3-
import { sendFeedbackToToska } from '../services/mailService'
3+
import { sendFeedback } from '../services/mailService'
44
import { ApplicationError } from '../util/customErrors'
55
import logger from '../util/logger'
66

@@ -20,7 +20,7 @@ router.post('/email', async (req: EmailRequest, res: Response) => {
2020
throw new ApplicationError('User not found', 404)
2121
}
2222

23-
await sendFeedbackToToska({
23+
await sendFeedback({
2424
feedbackContent: content,
2525
user,
2626
})

services/backend/src/services/mailService.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,7 @@ const sendEmail = async (options = {}) => {
2727
return await pateClient.post('/', options)
2828
}
2929

30-
export const sendFeedbackToToska = async ({
31-
feedbackContent,
32-
user,
33-
}: {
34-
feedbackContent: string
35-
user: FormattedUser
36-
}) => {
30+
export const sendFeedback = async ({ feedbackContent, user }: { feedbackContent: string; user: FormattedUser }) => {
3731
const { name, userId, email } = user
3832
const userDetails = `Sent by ${name}, userid: ${userId}, email: ${email}`
3933
const text = [feedbackContent, userDetails].join('<br />')

services/backend/src/services/userService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export const getMockedUser = async ({ userToMock, mockedBy }: { userToMock: stri
231231
return mockedUser
232232
}
233233

234-
export const getUserToska = async ({
234+
export const getUser = async ({
235235
username,
236236
name,
237237
email,

services/backend/src/util/importerClient.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@ import axios from 'axios'
33
import { importerToken, importerUrl } from '../config'
44
import logger from './logger'
55

6-
const toskaImporterClient = axios.create({
6+
const importerClient = axios.create({
77
headers: { token: importerToken },
88
baseURL: importerUrl,
99
timeout: 10000,
1010
})
1111

12-
const getToskaImporterClient = () => {
12+
export const getImporterClient = () => {
1313
if (!importerToken) {
1414
logger.error("Importer token not set, can't return client!")
1515
return null
1616
}
17-
return toskaImporterClient
17+
return importerClient
1818
}
19-
20-
export const getImporterClient = getToskaImporterClient

services/frontend/Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ ENV REACT_APP_SENTRY_RELEASE=$SENTRY_RELEASE
2222
ARG SENTRY_DSN=''
2323
ENV REACT_APP_SENTRY_DSN=$SENTRY_DSN
2424

25-
ARG SERVICE_PROVIDER='toska'
26-
ENV REACT_APP_SERVICE_PROVIDER=$SERVICE_PROVIDER
27-
2825
ARG LANGUAGE_CENTER_VIEW_ENABLED
2926
ENV REACT_APP_LANGUAGE_CENTER_VIEW_ENABLED=$LANGUAGE_CENTER_VIEW_ENABLED
3027

0 commit comments

Comments
 (0)