Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
Co-authored-by: PurkkaKoodari <[email protected]>
  • Loading branch information
kahlstrm and PurkkaKoodari committed May 27, 2023
1 parent f8a563b commit 290edb8
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
import { HttpError, Unauthorized } from 'http-errors';

import type { AdminLoginBody, AdminLoginResponse, AdminRenewLoginBody } from '@tietokilta/ilmomasiina-models';
import type { AdminLoginBody, AdminLoginResponse } from '@tietokilta/ilmomasiina-models';
import AdminAuthSession, { AdminTokenData } from '../../authentication/adminAuthSession';
import AdminPasswordAuth from '../../authentication/adminPasswordAuth';
import { User } from '../../models/user';
Expand Down Expand Up @@ -33,7 +33,7 @@ export function adminLogin(session: AdminAuthSession) {

export function renewAdminToken(session: AdminAuthSession) {
return async (
request: FastifyRequest<{ Body: AdminRenewLoginBody }>,
request: FastifyRequest,
reply: FastifyReply,
): Promise<AdminLoginResponse | void> => {
// Verify existing token
Expand Down
3 changes: 1 addition & 2 deletions packages/ilmomasiina-backend/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,10 @@ async function setupPublicRoutes(

// an API endpoint for session token renewal as variant of adminLoginSchema

server.post<{ Body: schema.AdminRenewLoginBody }>(
server.post(
'/authentication/renew',
{
schema: {
body: schema.adminRenewTokenBody,
response: {
...errorResponses,
201: schema.adminLoginResponse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ export const LOGGING_IN = 'auth/LOGGING_IN';
export const LOGIN_SUCCEEDED = 'auth/LOGIN_SUCCEEDED';
export const LOGIN_FAILED = 'auth/LOGIN_FAILED';
export const RESET = 'auth/RESET';
export const RENEWING_TOKEN = 'auth/RENEWING_TOKEN';
7 changes: 0 additions & 7 deletions packages/ilmomasiina-models/src/schema/login/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ export const adminLoginBody = Type.Object({
description: 'Plaintext password.',
}),
});
export const adminRenewTokenBody = Type.Object({
accessToken: Type.String({
description: 'JWT access token. Used in `Authorization` header to authorize requests.',
}),
});
/** Response schema for a successful login. */
export const adminLoginResponse = Type.Object({
accessToken: Type.String({
Expand All @@ -23,7 +18,5 @@ export const adminLoginResponse = Type.Object({

/** Request body for login. */
export type AdminLoginBody = Static<typeof adminLoginBody>;
/** Request body for renewLogin */
export type AdminRenewLoginBody = Static<typeof adminRenewTokenBody>;
/** Response schema for a successful login. */
export type AdminLoginResponse = Static<typeof adminLoginResponse>;

0 comments on commit 290edb8

Please sign in to comment.