|
|
@@ -1,9 +1,8 @@ |
|
|
|
import { |
|
|
|
application, |
|
|
|
DataSource, |
|
|
|
Resource, |
|
|
|
resource, |
|
|
|
valibot, |
|
|
|
valibot as v, |
|
|
|
dataSources, |
|
|
|
serializers |
|
|
|
} from '.'; |
|
|
@@ -49,11 +48,11 @@ const TEXT_SERIALIZER_PAIR = { |
|
|
|
deserialize: <T>(str: string) => str as T |
|
|
|
}; |
|
|
|
|
|
|
|
const Piano = resource(valibot.object( |
|
|
|
const Piano = resource(v.object( |
|
|
|
{ |
|
|
|
brand: valibot.string() |
|
|
|
brand: v.string() |
|
|
|
}, |
|
|
|
valibot.never() |
|
|
|
v.never() |
|
|
|
)) |
|
|
|
.name('Piano') |
|
|
|
.id('id', { |
|
|
@@ -62,15 +61,15 @@ const Piano = resource(valibot.object( |
|
|
|
|
|
|
|
// TODO implement authentication and RBAC on each resource |
|
|
|
|
|
|
|
const User = resource(valibot.object( |
|
|
|
const User = resource(v.object( |
|
|
|
{ |
|
|
|
firstName: valibot.string(), |
|
|
|
middleName: valibot.string(), |
|
|
|
lastName: valibot.string(), |
|
|
|
bio: valibot.string(), |
|
|
|
createdAt: valibot.date() |
|
|
|
firstName: v.string(), |
|
|
|
middleName: v.string(), |
|
|
|
lastName: v.string(), |
|
|
|
bio: v.string(), |
|
|
|
createdAt: v.date() |
|
|
|
}, |
|
|
|
valibot.never() |
|
|
|
v.never() |
|
|
|
)) |
|
|
|
.name('User') |
|
|
|
.fullText('bio') |
|
|
@@ -80,7 +79,7 @@ const User = resource(valibot.object( |
|
|
|
|
|
|
|
const app = application({ |
|
|
|
name: 'piano-service', |
|
|
|
dataSource: (resource: Resource) => new dataSources.jsonlFile.DataSource(resource), |
|
|
|
dataSource: (resource) => new dataSources.jsonlFile.DataSource(resource), |
|
|
|
}) |
|
|
|
.contentType('application/json', serializers.applicationJson) |
|
|
|
.contentType('text/json', serializers.textJson) |
|
|
|