Skip to content

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobuddy committed Mar 30, 2023
2 parents 550c569 + dd07d6a commit c622041
Show file tree
Hide file tree
Showing 79 changed files with 1,045 additions and 442 deletions.
2 changes: 0 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
## What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

## Description

## Related Issues
Expand Down
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@
"commandCenter.border": "#15202b99"
},
"peacock.color": "#fcdc3d",
"cSpell.words": ["bugsnag", "dasherize", "dtos", "nestjs", "typeorm"],
"cSpell.words": [
"bugsnag",
"casejs",
"dasherize",
"dtos",
"nestjs",
"typeorm"
],
"material-icon-theme.files.associations": {
"**.controller.ts": "nest-controller"
},
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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
27 changes: 10 additions & 17 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,16 @@
- [Overview](getting-started/overview.md)
- [Quick start guide](getting-started/quick-start-guide.md)
- [Structure](getting-started/structure.md)
- [Testing](getting-started/testing.md)

- 📖 Resources
- 📖 CRUD resources

- [Create a resource](resources/create-a-resource.md)
- [Create a property](resources/create-a-property.md)
- [Entity file](resources/entity-file.md)
- [Resource definitions](resources/resource-definitions.md)
- [Database seeder](resources/database-seeder)
- [Relations](resources/relations.md)

- 🧱 Elements

- [Inputs](elements/inputs.md)
- [Top menu quick links](elements/quick-links.md)
- [Breadcrumbs\*]()

- 📋 List view

- [List view](list/list.md)
Expand All @@ -28,7 +22,6 @@
- [Action buttons](list/action-buttons.md)
- [Dropdown links](list/dropdown-links.md)
- [Calculated columns](list/calculated-columns.md)
- [Pagination\*]()

- 📝 Create-Edit view

Expand All @@ -49,11 +42,11 @@
- [Actions](features/actions.md)
- [Flash messages](features/flash-messages.md)
- [Send emails](features/send-emails.md)
- [Pipes\*]()
- [Task scheduling\*](features/task-scheduling.md)
- [CLI](features/cli.md)
- [Notifications\*]()
- [Generate an Excel/Word/PDF file\*]()

- 🎨 Theme
- [Customize](theme/customize.md)

- [Task scheduling](features/task-scheduling.md)
- [Inputs](elements/inputs.md)
- [Testing](getting-started/testing.md)

- 🎨 Customization
- [Theme](theme/customize.md)
- [Top menu quick links](elements/quick-links.md)
Binary file not shown.
Binary file not shown.
Binary file not shown.
16 changes: 0 additions & 16 deletions docs/features/cli.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/getting-started/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CASE is a framework that allows you to **create web apps, ERPs and dashboards ea
## Main features

- Instant **CRUD system** for your entities ⚡
- Out-of-the-box **authentication** and **role-based access control** 🔐
- Out-of-the-box **authentication** and **role-based access control (RBAC)** 🔐
- Nice and clear **UI**

## Why CASE ?
Expand Down
10 changes: 5 additions & 5 deletions docs/getting-started/quick-start-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ CASE starter covers many use cases (ERP, dashboards, CRM, Custom software, Analy
### Step 1: Install CASE CLI

```
npm i -g @case-app/case-cli
npm i -g @casejs/case-cli
```

### Step 2: Create a new CASE project

Run the following command:

```sh
case-app new
cs new
```

During the installation, the terminal will ask you **what is the name of your application**. Type `my-case-project`
Expand Down Expand Up @@ -83,10 +83,10 @@ Now that we have our project ready with users and roles, we will need to add som

In our example, we will create **an app that lists famous painters and their works** (why not ?).

Run the `case-app resource [name]` command replacing the name by the singular, "camelCase" name of your resource:
Run the `cs generate resource [name]` command replacing the name by the singular, "camelCase" name of your resource:

```sh
case-app resource painter
cs generate resource painter
```

That's it, you have now a functional list of painters ! You already can create painters, edit them and delete them.
Expand Down Expand Up @@ -180,6 +180,6 @@ Last but not least, let's add the "country" field in create and edit forms to al

Now that you have the basics, you are free to make your CASE project evolve your way. Each project is different and its own business logic, you can add your own features.

If you encounter bugs or issues, [please let us know](https://github.com/case-app/case/issues/new).
If you encounter bugs or issues, [please let us know](https://github.com/casejs/case/issues/new).

Happy coding !
64 changes: 64 additions & 0 deletions docs/resources/create-a-property.md
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() |
67 changes: 23 additions & 44 deletions docs/resources/create-a-resource.md
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 !
Loading

0 comments on commit c622041

Please sign in to comment.