Skip to content

Create Server Service #3

@NathaelB

Description

@NathaelB

Spécifications

Create a service to manage server logic

  • retrieve the list of servers (with pagination) findAll
  • retrieve servers from a user findByUserId
  • retrieve a server from its id findById
  • create a server create
  • modify a server update
  • delete a server delete
export const getServersValidator = vine.compile(
  vine.object({
    page: vine.number().optional(),
    limit: vine.boolean().optional(),
  })
)
export type GetServersSchema = Infer<typeof getServersValidator>

export default class ServerService {
  async findAll({ page = 1, limit = 10 }: GetServersSchema) {
    return Server.query()
      .paginate(1, 10)
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions