From f49e04d2bd5d862f77d798829f469a9f5df8c4d4 Mon Sep 17 00:00:00 2001 From: ChipLuxury-EWA Date: Thu, 25 Apr 2024 10:03:03 +0300 Subject: [PATCH 1/2] added code group for ts and js entity code example --- docs/docs/working-without-decorators.md | 26 ++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/docs/working-without-decorators.md b/docs/docs/working-without-decorators.md index 9ce195f22..d40482920 100644 --- a/docs/docs/working-without-decorators.md +++ b/docs/docs/working-without-decorators.md @@ -2,7 +2,9 @@ If you prefer to work without decorators, or use `remult` in a javascript project (without typescript) you can use the following: ## Entity -```ts{8-16} +::: code-group + +```sh [TS] import { Entity, Fields, describeClass } from "remult"; export class Task { @@ -20,6 +22,28 @@ describeClass(Task, completed: Fields.boolean() }) ``` + +```sh [JS] +import { Entity, Fields, describeClass } from "remult"; + +export class Task { + id; + title = ''; + completed = false; +} +describeClass(Task, + Entity("tasks", { + allowApiCrud: true + }), + { + id: Fields.uuid(), + title: Fields.string(), + completed: Fields.boolean() + }) +``` + +::: + This is the same entity that is detailed in the [Entities section of the tutorial](https://remult.dev/tutorials/react/entities.html) ## Static BackendMethod From cb63e4e68ba0c17cfa5c644c2d483bcee7d3cb5f Mon Sep 17 00:00:00 2001 From: ChipLuxury-EWA Date: Thu, 25 Apr 2024 11:00:44 +0300 Subject: [PATCH 2/2] fixed tab headers and code set --- docs/docs/working-without-decorators.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/working-without-decorators.md b/docs/docs/working-without-decorators.md index d40482920..20434ca11 100644 --- a/docs/docs/working-without-decorators.md +++ b/docs/docs/working-without-decorators.md @@ -4,7 +4,7 @@ If you prefer to work without decorators, or use `remult` in a javascript projec ## Entity ::: code-group -```sh [TS] +```ts [Typescript] import { Entity, Fields, describeClass } from "remult"; export class Task { @@ -23,7 +23,7 @@ describeClass(Task, }) ``` -```sh [JS] +```js [Javascript] import { Entity, Fields, describeClass } from "remult"; export class Task {