Skip to content

Commit

Permalink
Simplify tutorial by automating data model install (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
QubitPi authored Aug 14, 2024
1 parent 0124bae commit e3fcd3d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 54 deletions.
6 changes: 0 additions & 6 deletions .github/actions/ci-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,3 @@ runs:
- name: Load Maven settings.xml
shell: bash
run: cp settings.xml.example ~/.m2/settings.xml
- name: Install data models
shell: bash
run: |
git clone https://github.com/${{ inputs.data-models-repo-org }}/${{ inputs.data-models-repo-name }}.git ../jpa-models
cd ../jpa-models
mvn clean install
53 changes: 6 additions & 47 deletions docs/docs/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,53 +44,12 @@ Please visit [Astraios GitHub] and either
Creating Models
---------------

Astraios models are some of the most important code in any webservice project. Our models are the view of our data that
we wish to expose. In this example we will be modeling a _book_ since most people have a high-level familiarity with
books in life.

Our _Book_ model looks something like this:

```java
import com.paiondata.elide.annotation.Include;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

@Entity
@Table(name = "book")
@Include(rootLevel = true, name = "book", description = "book entity", friendlyName = "book")
public class Book {

@Id
@GeneratedValue
public long id;

public String title = "";
}
```

:::tip

Models are usually packaged as **JAR** file in a separate Maven project. Here is a complete
[example](https://github.com/paion-data/astraios-data-models-example)

:::

In the end, run `mvn clean install` to install our model

:::info

From this point on, we assume [this example data model][astraios-data-models-example] is used

```bash
git clone git@github.com:paion-data/astraios-data-models-example.git
cd astraios-data-models-example
mvn clean install
```

:::
[Astraios] models are some of the most important code in any webservice project. Our models are the
view of our data that we wish to expose. In this example we will be modeling a _book_ since most people have a
high-level familiarity with books in life. Our _Book_ model has been packaged as a **JAR** file in a
[separate Maven project](https://github.com/paion-data/astraios-data-models-example). It has already been
published to Maven Central and will be installed in this tutorial by default so that user don't need to do anything
to set up the data model at this moment <img width="70px" src="https://github.com/QubitPi/QubitPi/blob/master/img/可莉-21.png?raw=true" />

Running
-------
Expand Down
2 changes: 1 addition & 1 deletion settings.xml.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<properties>
<model.package.jar.group.id>com.paiondata</model.package.jar.group.id>
<model.package.jar.artifact.id>astraios-data-models-example</model.package.jar.artifact.id>
<model.package.jar.version>1.0.0</model.package.jar.version>
<model.package.jar.version>2.0.8</model.package.jar.version>
</properties>
</profile>
</profiles>
Expand Down

0 comments on commit e3fcd3d

Please sign in to comment.