sonicjs icon indicating copy to clipboard operation
sonicjs copied to clipboard

categoriesToPost example is broken

Open PedroBraude opened this issue 9 months ago • 0 comments

Hello guys! when i click on '''categories-to-posts" i got this:

TypeError: Cannot read properties of undefined (reading 'table')
    at dataRoute (file:///home/mape/Documents/uccaep/sonicjs/src/cms/admin/admin.ts:284:64)
    at null.<anonymous> (file:///home/mape/Documents/uccaep/sonicjs/src/cms/admin/admin.ts:338:35)
    at dispatch (file:///home/mape/Documents/uccaep/sonicjs/node_modules/hono/dist/compose.js:29:23)
    at null.<anonymous> (file:///home/mape/Documents/uccaep/sonicjs/node_modules/hono/dist/compose.js:30:20)
    at null.<anonymous> (file:///home/mape/Documents/uccaep/sonicjs/src/cms/admin/admin.ts:51:9)
    at async dispatch (file:///home/mape/Documents/uccaep/sonicjs/node_modules/hono/dist/compose.js:29:17)
    at null.<anonymous> (async file:///home/mape/Documents/uccaep/sonicjs/.wrangler/tmp/dev-aYv4bs/bundledWorker-0.32029522575725444.js:32796:3)
    at async dispatch (file:///home/mape/Documents/uccaep/sonicjs/node_modules/hono/dist/compose.js:29:17)
    at null.<anonymous> (async file:///home/mape/Documents/uccaep/sonicjs/.wrangler/tmp/dev-aYv4bs/bundledWorker-0.32029522575725444.js:32782:3)
    at async dispatch (file:///home/mape/Documents/uccaep/sonicjs/node_modules/hono/dist/compose.js:29:17)
[wrangler:inf] GET /admin/api/categoriesToPosts 500 Internal Server Error (11ms)

I think there is a problem with 'posts.ts'.

When I log from 'categoriesToPosts.ts' all post exports explicitly I get this.

console.log({
  posts,
  postsTable,
  postsTableName,
  postsRoute,
  postsDefinition,
  postsRelation,
  postsAccess,
  postsHooks,
  postsFields,
});

log results
{
  posts: {
    access: [Getter],
    definition: [Getter],
    fields: [Getter],
    hooks: [Getter],
    relation: [Getter],
    route: [Getter],
    table: [Getter],
    tableName: [Getter]
  },
  postsTable: undefined,
  postsTableName: undefined,
  postsRoute: undefined,
  postsDefinition: undefined,
  postsRelation: undefined,
  postsAccess: undefined,
  postsHooks: undefined,
  postsFields: undefined,
}

PedroBraude avatar May 14 '24 10:05 PedroBraude