feat: add changelog commit schema

This commit is contained in:
Lars Hampe 2024-10-26 15:12:43 +02:00
parent 106b3c0545
commit 5467e78596
4 changed files with 23 additions and 13 deletions
packages
logger/src
schema/src/commit

View File

@ -5,7 +5,11 @@ import winston from 'winston'
// Create a Winston logger - passing in the Logtail transport
export const logger = winston.createLogger({
format: winston.format.json(),
transports: [],
transports: [
new winston.transports.Console({
format: winston.format.json(),
}),
],
})
if (import.meta.env.NODE_ENV === 'production') {
@ -13,11 +17,3 @@ if (import.meta.env.NODE_ENV === 'production') {
const logtail = new Logtail(process.env.BETTERSTACK_LOG_TOKEN as string)
logger.add(new LogtailTransport(logtail))
}
if (import.meta.env.NODE_ENV === 'development') {
logger.add(
new winston.transports.Console({
format: winston.format.json(),
}),
)
}

View File

@ -30,7 +30,6 @@ export const CommitCreateInput = z
body: z.string().optional(),
}),
)
.openapi({
required: ['changelogId', 'commit', 'subject'],
})

View File

@ -1,5 +1,5 @@
export * from './base'
//export * from './byId'
export * from './create'
//export * from './list'
export * from './list'
//export * from './update'

View File

@ -1,4 +1,19 @@
import { z } from '@hono/zod-openapi'
import { VersionOutput } from './base'
import { CommitOutput } from './base'
export const VersionListOutput = z.array(VersionOutput)
export const CommitListOutput = z.array(CommitOutput)
export const CommitListParams = z.object({
changelogId: z
.string()
.uuid()
.openapi({
param: {
name: 'changelogId',
in: 'query',
},
example: 'a5ed5965-0506-44e6-aaec-0465ff9fe092',
}),
limit: z.number().or(z.string()).optional(),
offset: z.number().or(z.string()).optional(),
hasVersion: z.boolean().default(false),
})