How to refactor to create-t3-app?
I have the following setup. I have a Django backend and a Nextjs frontend. In Next, I replicate my Django models and have api functions for accessing the api endpoints from Django.
How would I refactor this setup to an app that's created with
How would I refactor this setup to an app that's created with
create-t3-appcreate-t3-appProduct/index.tsProduct/index.tsexport default class Product extends Base implements IProduct {
name: string;
description?: string;
brand?: IBrand;
bestseller: boolean;
type: string;
category?: ICategory | null;
lsExternalId?: string;
archived: boolean;
stockCount?: number;
constructor({
id = undefined,
createdAt = undefined,
updatedAt = undefined,
name,
description = undefined,
brand = undefined,
bestseller = false,
type,
category = undefined,
lsExternalId = undefined,
archived = false,
stockCount = undefined,
}: IBase & IProduct) {
super({ id, createdAt, updatedAt });
this.name = name;
this.description = description;
this.brand = new Brand({ ...brand });
this.bestseller = bestseller;
this.type = type;
this.category = category ? new Category({ ...category }) : undefined;
this.lsExternalId = lsExternalId;
this.archived = archived;
this.stockCount = stockCount;
}
}export default class Product extends Base implements IProduct {
name: string;
description?: string;
brand?: IBrand;
bestseller: boolean;
type: string;
category?: ICategory | null;
lsExternalId?: string;
archived: boolean;
stockCount?: number;
constructor({
id = undefined,
createdAt = undefined,
updatedAt = undefined,
name,
description = undefined,
brand = undefined,
bestseller = false,
type,
category = undefined,
lsExternalId = undefined,
archived = false,
stockCount = undefined,
}: IBase & IProduct) {
super({ id, createdAt, updatedAt });
this.name = name;
this.description = description;
this.brand = new Brand({ ...brand });
this.bestseller = bestseller;
this.type = type;
this.category = category ? new Category({ ...category }) : undefined;
this.lsExternalId = lsExternalId;
this.archived = archived;
this.stockCount = stockCount;
}
}