api Controller & token
This commit is contained in:
parent
36ecccd0dc
commit
4568bef10e
8 changed files with 115 additions and 5 deletions
|
@ -7,6 +7,9 @@ import { CreateApiCommand, DeleteApiCommand, UpdateApiCommand } from "../../../c
|
|||
import ApiCommandHandler from "../../../command/user/api/apiCommandHandler";
|
||||
import { UpdateApiPermissionsCommand } from "../../../command/user/api/apiPermissionCommand";
|
||||
import ApiPermissionCommandHandler from "../../../command/user/api/apiPermissionCommandHandler";
|
||||
import { JWTHelper } from "../../../helpers/jwtHelper";
|
||||
import { CLUB_NAME } from "../../../env.defaults";
|
||||
import { StringHelper } from "../../../helpers/stringHelper";
|
||||
|
||||
/**
|
||||
* @description get All apis
|
||||
|
@ -69,10 +72,15 @@ export async function createApi(req: Request, res: Response): Promise<any> {
|
|||
let title = req.body.title;
|
||||
let expiry = req.body.expiry;
|
||||
|
||||
// TODO: create jwt as token to prevent random string tests
|
||||
let token = await JWTHelper.create({
|
||||
iss: CLUB_NAME,
|
||||
sub: "api_token_retrieve",
|
||||
iat: new Date().toISOString(),
|
||||
aud: StringHelper.random(32),
|
||||
});
|
||||
|
||||
let createApi: CreateApiCommand = {
|
||||
token: "",
|
||||
token: token,
|
||||
title: title,
|
||||
expiry: expiry,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue