这是我的用户模型,它已扩展且工作正常,唯一我仍然不知道如何使用此模型在 nextjs 应用程序的任何其他 API 路由中手动执行 CRUD?我想在我的其他 API 路由中创建条带会话时更新 stripeSessionId。
// Extend the built-in models using class inheritance
export default class User extends Adapters.TypeORM.Models.User.model {
// You can extend the options in a model but you should not remove the base
// properties or change the order of the built-in options on the constructor
constructor(name, email, image, emailVerified) {
super(name, email, image, emailVerified);
}
}
export const UserSchema = {
name: "User",
target: User,
columns: {
...Adapters.TypeORM.Models.User.schema.columns,
// Adds a phoneNumber to the User schema
stripeSessionId: {
type: "string",
nullable: true,
},
subcriptionId: {
type: "string",
nullable: true,
},
},
};