adminjs icon indicating copy to clipboard operation
adminjs copied to clipboard

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

Open BrianLYS opened this issue 1 year ago • 0 comments

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 avatar Jul 28 '24 11:07 BrianLYS