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

Failed to generate admin dashboard #73

Open
smartnode opened this issue Nov 30, 2024 · 0 comments
Open

Failed to generate admin dashboard #73

smartnode opened this issue Nov 30, 2024 · 0 comments

Comments

@smartnode
Copy link

smartnode commented Nov 30, 2024

  1. Schema does not work as it is provided from https://docs.teodev.io/getting-started/beginner-tutorial/generate-admin-dashboard. Probably missing request before middlewares.
Schema
connector {
  provider: .mysql,
  url: "mysql://localhost:3306/helloadmindashboard",
}
 
server {
  bind: ("0.0.0.0", 5054)
}
 
admin {
  dest: "../hello-teo-admin-dashboard",
  host: .inject("process.env.TEO_HOST"),
  languages: [.enUs, .enUk, .de, .es, .fr, .he, .hi, .ja, .ko, .zhCn, .zhTw]
}
 
@identity.tokenIssuer($identity.jwt(expired: 3600 * 24 * 365))
@identity.jwtSecret(ENV["JWT_SECRET"]!) @admin.administrator
model Root {
  @id @autoIncrement @readonly
  id: Int
  @unique @onSet($if($presents, $isEmail)) @identity.id
  email: String
  @writeonly @onSet($presents.bcrypt.salt) @admin.secureInput
  @identity.checker($get(.value).presents.bcrypt.verify($self.get(.password).presents))
  password: String
 
  include handler identity.signIn
  include handler identity.identity
}
 
@identity.tokenIssuer($identity.jwt(expired: 3600 * 24 * 365))
@identity.jwtSecret(ENV["JWT_SECRET"]!) @admin.administrator
model Admin {
  @id @autoIncrement @readonly
  id: Int
  @unique @onSet($if($presents, $isEmail)) @identity.id
  email: String
  @unique @identity.id
  phoneNo: String
  @writeonly @onSet($presents.bcrypt.salt) @admin.secureInput
  @identity.checker($get(.value).presents.bcrypt.verify($self.get(.password).presents))
  password: String
 
  include handler identity.signIn
  include handler identity.identity
}
 
enum Sex {
  male
  female
}
 
model Record {
  @id @autoIncrement @readonly
  id: Int
  string: String
  bool: Bool
  int: Int
  float: Float
  decimal: Decimal
  date: Date
  dateTime: DateTime
  sex: Sex
}
 
model NullableRecord {
  @id @autoIncrement @readonly
  id: Int
  string: String?
  bool: Bool?
  int: Int?
  float: Float?
  decimal: Decimal?
  date: Date?
  dateTime: DateTime?
  sex: Sex?
}
 
middlewares [identity.identityFromJwt(secret: ENV["JWT_SECRET"]!)]
 
autoseed dataset default {
  group Admin {
    record admin {
      email: "[email protected]",
      phoneNo: "13588888888",
      password: "Aa123456"
    }
  }
  group Root {
    record root {
      email: "[email protected]",
      password: "Aa123456"
    }
  }
}
  1. cargo teo generate admin does not generate admin frontend, and gives following error:
Error: teo_result::Error: {"code":500,"message":"error decoding response body","errors":null}
  1. I cloned https://github.com/teodevgroup/teo-admin-dev and tried following
npm install
npm start

Gives following error :

ERROR in ./src/index.tsx
Module build failed (from ./node_modules/@wyw-in-js/webpack-loader/lib/index.js):
SyntaxError: /home/smartnode/projects/psa.storeling/frontend/src/index.tsx: Support for the experimental syntax 'jsx' isn't currently enabled (16:13):

  14 | document.body.appendChild(container)
  15 | const root = createRoot(container)
> 16 | root.render(<StrictMode>
     |             ^
  17 |     <App />
  18 | </StrictMode>)
  19 |
@smartnode smartnode changed the title schema.teo in docs does NOT work Failed to generate admin dashboard Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant