-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
Looking for a way to use snake_case on the server side and camelCase on the client. Put together a POC at https://github.com/altintx/jsonapi-client/pull/1/files but do not believe it to be right. Specifically, I believe schema.ts:30: is expecting the names to be the same between the interface and the schema. For the linked implementation, I imagined doing something like
interface INotification {
subject: Person;
id: string;
subjectId: string;
sentAt: Date;
contentJson: Json;
status: 'error' | 'draft' | 'sent' | 'ready';
createdAt: Date;
updatedAt: Date;
}
const NotificationSchema = new Schema<INotification>({
attributes: {
subjectId: {},
sentAt: {},
contentJson: {},
status: {},
createdAt: {},
updatedAt: {},
},
relationships: {
subject: {},
}
}, { serverTransform: "snake_case", clientTransform: "camelCase" }); // <---------
export class Notification extends model(NotificationSchema) { }
but like I said, my approach is hardly an ideal starting ground
Metadata
Metadata
Assignees
Labels
No labels