Ulf Gebhardt b464a380ca
refactor(backend): lint @typescript-eslint/recommended-requiring-type-checking (#8407)
* lint @typescript-eslint/recommended

* lint @typescript-eslint/recommended-requiring-type-checking

fix type not detected locally due to wierd uuid typings

missing save

error not reported locally

---------

Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com>
2025-04-21 10:32:44 +00:00

20 lines
649 B
TypeScript

/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import jwt from 'jsonwebtoken'
import CONFIG from '@config/index'
// Generate an Access Token for the given User ID
export default function encode(user) {
const { id, name, slug } = user
const token = jwt.sign({ id, name, slug }, CONFIG.JWT_SECRET, {
expiresIn: CONFIG.JWT_EXPIRES,
issuer: CONFIG.GRAPHQL_URI,
audience: CONFIG.CLIENT_URI,
subject: user.id.toString(),
})
return token
}