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