Appearance
CRUD Service and Data Models
A large building block of the Vasat framework is the infastrcuture to manage an application's data.
Vasat allows the definition of models as plain Scala objects and provides the infastrcuture to store, sertialise, validate and access control your application's custom data structures.
eg: A plain object and its Vasat ModelContext
scala
@JSONModel
case class Article(
name:String,
category:String,
author:Ref[Author],
datePosted:Date,
deleted:Boolean
)
@DBAuto
class ArticleRepo extends DBContext[Article,SlickBaseTable]
Json representation of object
json
{
"name":"The Vasat Guide",
"category":"tech",
"author":"xxxx-xxxxx-xxxx-xxxx",
"datePosted":1723768147000,
"deleted":false
}
Auto generated CRUD Endpoints
GET /api/Article - Search
POST /api/Article - Create
PUT /api/Article/:id - Update
GET /api/Article/:id - Read
DELETE /api/Article/:id - Delete