Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Unexpected type: timestamp with time zone fallback to string #1689

Open
BrianLYS opened this issue Jul 28, 2024 · 0 comments
Open

[Bug]: Unexpected type: timestamp with time zone fallback to string #1689

BrianLYS opened this issue Jul 28, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@BrianLYS
Copy link

Contact Details

No response

What happened?

I have a column with datetime

import { DateTime } from 'luxon'
import hash from '@adonisjs/core/services/hash'
import { compose } from '@adonisjs/core/helpers'
import { BaseModel, column } from '@adonisjs/lucid/orm'
import { withAuthFinder } from '@adonisjs/auth/mixins/lucid'

const AuthFinder = withAuthFinder(() => hash.use('scrypt'), {
  uids: ['email'],
  passwordColumnName: 'password',
})

export default class User extends compose(BaseModel, AuthFinder) {
  @column({ isPrimary: true })
  declare id: number

  @column()
  declare fullName: string | null

  @column()
  declare email: string

  @column({ serializeAs: null })
  declare password: string

  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime

  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime | null
}
adminjs: {
    rootPath: '/admin',
    loginPath: '/admin/login',
    logoutPath: '/admin/logout',
    componentLoader,
    resources: [
      {
        resource: new LucidResource(User, 'postgres'),
        options: {
          properties: {
            // Add this to ensure all properties are included
            id: { isVisible: true },
            // Add custom property types for date and datetime fields
            createdAt: { type: 'datetime' },
            updatedAt: { type: 'datetime' },
          },
        },
      },
image and I would get rows of unexpected type errors

Seems to be working fine creating a new row at least.
image

How do I silence the errors?

Bug prevalence

All the time

AdminJS dependencies version

"@adminjs/adonis": "^1.1.0",
"@adonisjs/lucid": "^20.6.0",
"adminjs": "^7.8.7",

What browsers do you see the problem on?

No response

Relevant log output

No response

Relevant code that's giving you issues

No response

@BrianLYS BrianLYS added the bug Something isn't working label Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant