From e6a76a38142f9cd6cae566f764a943a96e891818 Mon Sep 17 00:00:00 2001 From: Romain Lanz <2793951+RomainLanz@users.noreply.github.com> Date: Wed, 12 Oct 2022 16:34:04 +0200 Subject: [PATCH] fix(templates): correct import & nullable field (#209) --- templates/config/auth.txt | 2 +- templates/middleware/Auth.txt | 4 ++-- templates/middleware/SilentAuth.txt | 2 +- templates/migrations/api_tokens.txt | 2 +- templates/migrations/auth.txt | 2 +- templates/model.txt | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/templates/config/auth.txt b/templates/config/auth.txt index 66fea74..dcc7727 100644 --- a/templates/config/auth.txt +++ b/templates/config/auth.txt @@ -5,7 +5,7 @@ * file. */ -import { AuthConfig } from '@ioc:Adonis/Addons/Auth' +import type { AuthConfig } from '@ioc:Adonis/Addons/Auth' /* |-------------------------------------------------------------------------- diff --git a/templates/middleware/Auth.txt b/templates/middleware/Auth.txt index 581b241..1a26ad0 100644 --- a/templates/middleware/Auth.txt +++ b/templates/middleware/Auth.txt @@ -1,6 +1,6 @@ -import { GuardsList } from '@ioc:Adonis/Addons/Auth' -import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext' import { AuthenticationException } from '@adonisjs/auth/build/standalone' +import type { GuardsList } from '@ioc:Adonis/Addons/Auth' +import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext' /** * Auth middleware is meant to restrict un-authenticated access to a given route diff --git a/templates/middleware/SilentAuth.txt b/templates/middleware/SilentAuth.txt index 8288620..5d3ac8f 100644 --- a/templates/middleware/SilentAuth.txt +++ b/templates/middleware/SilentAuth.txt @@ -1,4 +1,4 @@ -import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext' +import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext' /** * Silent auth middleware can be used as a global middleware to silent check diff --git a/templates/migrations/api_tokens.txt b/templates/migrations/api_tokens.txt index 05189ab..29a36da 100644 --- a/templates/migrations/api_tokens.txt +++ b/templates/migrations/api_tokens.txt @@ -1,6 +1,6 @@ import BaseSchema from '@ioc:Adonis/Lucid/Schema' -export default class {{ tokensSchemaName }} extends BaseSchema { +export default class extends BaseSchema { protected tableName = '{{ tokensTableName }}' public async up() { diff --git a/templates/migrations/auth.txt b/templates/migrations/auth.txt index a564a1d..0607247 100644 --- a/templates/migrations/auth.txt +++ b/templates/migrations/auth.txt @@ -1,6 +1,6 @@ import BaseSchema from '@ioc:Adonis/Lucid/Schema' -export default class {{ usersSchemaName }} extends BaseSchema { +export default class extends BaseSchema { protected tableName = '{{ usersTableName }}' public async up() { diff --git a/templates/model.txt b/templates/model.txt index 94bae1d..37bd79b 100644 --- a/templates/model.txt +++ b/templates/model.txt @@ -13,7 +13,7 @@ export default class {{ modelName }} extends BaseModel { public password: string @column() - public rememberMeToken?: string + public rememberMeToken: string | null @column.dateTime({ autoCreate: true }) public createdAt: DateTime