-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
79 changed files
with
1,045 additions
and
442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,13 +9,13 @@ Development of reliable and powerful application and ERP. CASE is fully customiz | |
### 1. Clone the repository | ||
|
||
```sh | ||
git clone [email protected]:case-app/case.git | ||
git clone [email protected]:casejs/case.git | ||
``` | ||
|
||
### 2. Clone the case-starter repository | ||
|
||
```sh | ||
git clone [email protected]:case-app/case-starter.git | ||
git clone [email protected]:casejs/case-starter.git | ||
``` | ||
|
||
### 3. Install the dependencies | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,13 +20,13 @@ Follow our [quickstart guide](https://docs.case.app) to learn how to set up a CA | |
1. **Install CASE CLI** | ||
|
||
```sh | ||
npm i -g @case-app/case-cli | ||
npm i -g @casejs/case-cli | ||
``` | ||
|
||
2. **Create a new CASE proejct** | ||
2. **Create a new CASE project** | ||
|
||
```sh | ||
case-app new | ||
cs new | ||
``` | ||
|
||
During the installation, when the terminal asks you what is the name of your application, just write your application's name and press `Enter`. | ||
|
@@ -72,6 +72,12 @@ Follow our [quickstart guide](https://docs.case.app) to learn how to set up a CA | |
> You can use the email `[email protected]` and password `case` to log in. | ||
# Serve the documentation | ||
```sh | ||
npm run start:docs | ||
``` | ||
# Deploying to production | ||
...Coming soon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-22.9 KB
docs/assets/images/create-edit/Screenshot from 2022-02-18 09-23-16.png
Binary file not shown.
Binary file removed
BIN
-106 KB
docs/assets/images/create-edit/Screenshot from 2022-02-18 09-23-31.png
Binary file not shown.
Binary file removed
BIN
-23.6 KB
docs/assets/images/create-edit/Screenshot from 2022-02-18 09-23-53.png
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Create a property | ||
|
||
CASE provides a fast and effective way to add properties to new or existing resources. | ||
|
||
## Introduction | ||
|
||
### What is a property ? | ||
|
||
A property is a member of a [resource](resources/create-a-resource.md) that associates a key with a value. That value can be a string, a number, a boolean or even more. | ||
|
||
Think about a **product** in a store, its property would be for example: a _name_, a _description_,a _photo_, and a _value_ in your currency. | ||
|
||
### CASE properties | ||
|
||
CASE properties are fast to create and adapted to the context because they are thought **end-to-end**: | ||
|
||
- Database storage | ||
- TypeScript types | ||
- UI display in [lists](list/list.md) and [detail](detail/detail.md) pages | ||
- Create/edit [input](elements/inputs.md) | ||
- Dummy values for [seeds](resources/database-seeder) | ||
|
||
## Create a property | ||
|
||
### CLI Command | ||
|
||
On the root level, run the command below replacing `[name]` by the name of your property in camelCase. You also need to pass the "resource" argument with the name of your resource (singular, camelCase). | ||
|
||
``` | ||
cs generate property [name] --resource=[resourceName] | ||
cs g prop [name] --resource=[resourceName] | ||
``` | ||
|
||
If you [create a new resource](resources/create-a-resource.md) | ||
|
||
## Property types | ||
|
||
CASE properties have "types" that will help you to format their logic and display on the flow. | ||
|
||
``` | ||
cs g prop [name]:[type] --resource=[resourceName] | ||
cs g prop bio:text --resource=user | ||
cs g prop photo:image --resource=product | ||
cs g prop isValidated:boolean --resource=intervention | ||
``` | ||
|
||
> [!ATTENTION] | ||
> Those types are not TypeScript types. They correspond to the essence of the property **in its usage**, thinking about the final user. Example: an _amount_ in € and the _height_ of a product are both _numbers_ in the code, but for CASE the are different as the displays, inputs and seed values will be different. | ||
### Available types | ||
|
||
| Type | Column yield | Input | TS type | DB column | Seed function | DTO Validator | | ||
| ------------ | ------------ | ----------- | ------- | --------- | ------------------------ | --------------- | | ||
| **string** | text | text | string | varchar | faker.random.word() | @IsString() | | ||
| **number** | text | number | number | int | faker.datatype.number() | @IsNumber() | | ||
| **currency** | currency | number | number | decimal | faker.finance.amount() | @IsNumber() | | ||
| **date** | date | datepicker | string | date | faker.date.past() | @IsDateString() | | ||
| **text** | text | textarea | string | text | faker.lorem.paragraphs() | @IsString() | | ||
| **email** | text | email | string | varchar | faker.internet.email() | @IsEmail() | | ||
| **boolean** | check | checkbox | boolean | tinyint | faker.datatype.boolean() | @IsBoolean() | | ||
| **file** | download | file | string | varchar | case.dummyFile() | @IsString() | | ||
| **image** | image | image | string | varchar | case.dummyImage() | @IsString() | | ||
| **color** | color | colorPicker | string | varchar | faker.internet.color() | @IsString() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,41 @@ | ||
# Create a resource | ||
|
||
### What is a resource ? | ||
|
||
A resource is an object often linked to a real world concept, like users, customers, videos, items, books etc. | ||
CASE provides a fast and effective way to create your CRUD resources through the CLI. | ||
|
||
### Technologies | ||
|
||
Under the table, CASE is using [TypeORM Entities](https://typeorm.io/#/entities) for resource management. We recommend you to have a deep look about TypeORM Entities general concepts, relationships, and available columns types. | ||
|
||
### Create a resource | ||
|
||
On the root level, run the command below replacing `[name]` by the name of your resource. | ||
|
||
```bash | ||
case-app resource [name] | ||
``` | ||
## Introduction | ||
|
||
### Files generated | ||
With resources, CASE handles all the dirty work for you: typing, create/edit form, dummy values, pagination, etc. | ||
|
||
This command will instantly creates for you, in the _client_ and the _server_ directories, all the basics files and functions you need to manage that resource ! | ||
### What is a resource ? | ||
|
||
Take a deeper look on the files created with an example of a basic CRM with a list of **Customers**. | ||
A resource is an object often linked to a real world concept, like users, customers, videos, items, books etc. | ||
|
||
The command above will produce the following elements/features : | ||
### Working with TypeORM | ||
|
||
In **server** directory _(back-end)_ : | ||
Under the table, CASE is using [TypeORM Entities](https://typeorm.io/#/entities) for resource management. We recommend you to have a deep look about TypeORM Entities general concepts, relationships, and available columns types. | ||
|
||
A new **Customer** folder is generated in `server/src/resources/` | ||
## Create a resource | ||
|
||
![Zoom on resource example in server](../assets/images/structure/server-resource-example.png 'Zoom on resource example in server') | ||
### CLI Command | ||
|
||
- An [Entity file](resources/entity-file.md) that corresponds to a new DB table that will be created automatically | ||
- A module importing all the dependencies needed | ||
- A REST controller with the CRUD endpoints working with their respective permissions | ||
- A resource service withe the CRUD functions list, show, store, update, destroy | ||
On the root level, run the command below replacing `[name]` by the name of your resource (singular and camelCase, example: "user", "vendingMachine"). | ||
|
||
The schematics will also creates a seeder file and add the resource name into a list permissions. | ||
``` | ||
cs generate resource [name] | ||
cs g res [name] | ||
``` | ||
|
||
![Zoom on seeder example in server](../assets/images/structure/server-seeder-example.png 'Zoom on seeder example in server') | ||
By default, the resource generated will have a `name` property. | ||
|
||
- A [seeder file](resources/database-seeder.md) to create a bunch of dummy Customers for your development | ||
- A set of [permissions](features/roles-and-permissions.md) related to the new resource: 'addCustomers', 'editCustomers' | ||
Of course you can [add properties](resources/create-a-property.md) directly from this command to make it real quick: | ||
|
||
In **client** directory _(front-end)_ : | ||
``` | ||
cs generate resource product --props=name,price:currency,photo:image | ||
``` | ||
|
||
![Zoom on client resource example](../assets/images/structure/client-resource-example.png 'Zoom on client resource example') | ||
> [!TIP] | ||
> You can choose between several property types to adapt the logic and the UI. Have a look at the [create property section](resources/create-a-property.md) for the full list of available types. | ||
- A set a new views for the front-end : [List View](list/list.md), [Create and Edit View](create-edit/create-edit.md) | ||
- A [resource definition file](resources/resource-definitions.md) to edit the Customer resource | ||
- A new link in the sidebar to see the **Customer list** | ||
- You may want to create a [Detail view](detail/detail.md) | ||
### Files generated | ||
|
||
> To follow that example, you may want to (in that order) : | ||
> | ||
> - Add new properties/columns to Customers to the `customer.entity.ts` file | ||
> - Add example values to those properties in the `customer.seeder.ts` and then seed with `npm run seed` to see the result | ||
> - Add [yields](list/yields.md) and [filters](list/filters.md) to add columns in the list view >in `customer.yields.ts` | ||
> - Add [fields](create-edit/fields.md) to the create and edit view to allow users to create >and edit **Customers** | ||
> - Edit the [roles](features/roles-and-permissions.md) to decide which user can or cannot edit >**Customers** | ||
> - Find a nice icon for it on [Feather icons](https://feathericons.com/) and set it in `menu-items.ts` | ||
> - And voilà ! You have now a manageable list of customers entirely manageable. | ||
This command will instantly creates for you, in the client and the server directories, all the basics files and functions you need to manage that resource ! |
Oops, something went wrong.