Ulf Gebhardt f782032563
refactor(backend): lint - import/order (#8350)
* lint - import/no-relative-parent-imports

fix build error

* fix md

* lint import/order

enabled rule import/order and fixed impot order in each file
2025-04-09 09:44:48 +02:00

16 lines
412 B
TypeScript

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
}