Skip to content

Commit

Permalink
Revert "[Backend] Type routes/feedback"
Browse files Browse the repository at this point in the history
This reverts commit d8dcf16.
  • Loading branch information
valtterikantanen committed Jul 22, 2024
1 parent 1118d2b commit 6f8b613
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 50 deletions.
20 changes: 20 additions & 0 deletions services/backend/src/routes/feedback.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const router = require('express').Router()

const { sendFeedbackToToska } = require('../services/mailService')
const logger = require('../util/logger')

router.post('/email', async req => {
const {
body: { content },
user,
} = req

await sendFeedbackToToska({
feedbackContent: content,
user,
})

logger.info(`${user.userId} succesfully sent feedback to toska`)
})

module.exports = router
34 changes: 0 additions & 34 deletions services/backend/src/routes/feedback.ts

This file was deleted.

9 changes: 5 additions & 4 deletions services/backend/src/routes/login.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { Response, Router } from 'express'
import { Request, Response, Router } from 'express'
import { omit } from 'lodash'

import { OodikoneRequest } from '../types'
import { FormattedUser } from '../types'
import { ApplicationError } from '../util/customErrors'

const router = Router()

interface LoginRequest extends OodikoneRequest {
interface CustomRequest extends Request {
user?: FormattedUser
logoutUrl?: string
}

router.get('/', async (req: LoginRequest, res: Response) => {
router.get('/', async (req: CustomRequest, res: Response) => {
const { user, logoutUrl } = req

if (!user) {
Expand Down
3 changes: 1 addition & 2 deletions services/backend/src/services/mailService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import axios from 'axios'

import { isProduction, pateToken } from '../config'
import { FormattedUser } from '../types'
import { ApplicationError } from '../util/customErrors'

const pateClient = axios.create({
Expand Down Expand Up @@ -32,7 +31,7 @@ export const sendFeedbackToToska = async ({
user,
}: {
feedbackContent: string
user: FormattedUser
user: { name: string; userId: string; email: string }
}) => {
const { name, userId, email } = user
const userDetails = `Sent by ${name}, userid: ${userId}, email: ${email}`
Expand Down
2 changes: 0 additions & 2 deletions services/backend/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { ExtentCode } from './extentCode'
import { GenderCode } from './genderCode'
import { Language } from './language'
import { Name } from './name'
import { OodikoneRequest } from './oodikoneRequest'
import { Phase } from './phase'
import { PriorityCode } from './priorityCode'
import { Role } from './role'
Expand All @@ -25,7 +24,6 @@ export {
GenderCode,
Language,
Name,
OodikoneRequest,
Phase,
PriorityCode,
Role,
Expand Down
8 changes: 0 additions & 8 deletions services/backend/src/types/oodikoneRequest.ts

This file was deleted.

0 comments on commit 6f8b613

Please sign in to comment.