celebrate#celebrate TypeScript Examples

The following examples show how to use celebrate#celebrate. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: providers.routes.ts    From GoBarber with MIT License 6 votes vote down vote up
providersRouter.get(
  '/:provider_id/month-availability',
  celebrate({
    [Segments.PARAMS]: {
      provider_id: Joi.string().uuid().required(),
    },
  }),
  providersMonthAvailabilityController.index,
);
Example #2
Source File: routes.ts    From NextLevelWeek with MIT License 6 votes vote down vote up
// Validação utilizando o celebrate.
routes.post(
    "/points",
    upload.single("image"),
    celebrate(
        {
            body: Joi.object().keys({
                name: Joi.string().required(),
                email: Joi.string().required().email(),
                whatsapp: Joi.number().required(),
                latitude: Joi.number().required(),
                longitude: Joi.number().required(),
                uf: Joi.string().required().max(2),
                city: Joi.string().required(),
                items: Joi.string().required(),
            }),
        },
        {
            abortEarly: false,
        }
    ),
    pointsController.create
);
Example #3
Source File: appointments.routes.ts    From gobarber-project with MIT License 6 votes vote down vote up
appointmentsRouter.post(
  '/',
  celebrate({
    [Segments.BODY]: {
      provider_id: Joi.string().uuid().required(),
      date: Joi.date(),
    },
  }),
  appointmentsController.create,
);
Example #4
Source File: providers.routes.ts    From gobarber-project with MIT License 6 votes vote down vote up
providersRouter.get(
  '/:provider_id/month-availability',
  celebrate({
    [Segments.PARAMS]: {
      provider_id: Joi.string().uuid().required(),
    },
  }),
  providerMonthAvailabilityController.index,
);
Example #5
Source File: providers.routes.ts    From gobarber-project with MIT License 6 votes vote down vote up
providersRouter.get(
  '/:provider_id/day-availability',
  celebrate({
    [Segments.PARAMS]: {
      provider_id: Joi.string().uuid().required(),
    },
  }),
  providerDayAvailabilityController.index,
);
Example #6
Source File: password.routes.ts    From gobarber-project with MIT License 6 votes vote down vote up
passwordRouter.post(
  '/forgot',
  celebrate({
    [Segments.BODY]: {
      email: Joi.string().email().required(),
    },
  }),
  forgotPasswordController.create,
);
Example #7
Source File: password.routes.ts    From gobarber-project with MIT License 6 votes vote down vote up
passwordRouter.post(
  '/reset',
  celebrate({
    [Segments.BODY]: {
      token: Joi.string().uuid().required(),
      password: Joi.string().required(),
      password_confirmation: Joi.string().required().valid(Joi.ref('password')),
    },
  }),
  resetPasswordController.create,
);
Example #8
Source File: profile.routes.ts    From gobarber-project with MIT License 6 votes vote down vote up
profileRouter.put(
  '/',
  celebrate({
    [Segments.BODY]: {
      name: Joi.string().required(),
      email: Joi.string().email().required(),
      old_password: Joi.string(),
      password: Joi.string(),
      password_confirmation: Joi.string().valid(Joi.ref('password')),
    },
  }),
  profileController.update,
);
Example #9
Source File: sessions.routes.ts    From gobarber-project with MIT License 6 votes vote down vote up
sessionsRouter.post(
  '/',
  celebrate({
    [Segments.BODY]: {
      email: Joi.string().email().required(),
      password: Joi.string().required(),
    },
  }),
  sessionsController.create,
);
Example #10
Source File: users.routes.ts    From gobarber-project with MIT License 6 votes vote down vote up
usersRouter.post(
  '/',
  celebrate({
    [Segments.BODY]: {
      name: Joi.string().required(),
      email: Joi.string().email().required(),
      password: Joi.string().required(),
    },
  }),
  usersController.create,
);
Example #11
Source File: appointments.routes.ts    From GoBarber with MIT License 6 votes vote down vote up
appointmentsRouter.post(
  '/',
  celebrate({
    [Segments.BODY]: {
      provider_id: Joi.string().uuid().required(),
      date: Joi.date(),
    },
  }),
  appointmentsController.create,
);
Example #12
Source File: points.routes.ts    From ecoleta with MIT License 6 votes vote down vote up
pointsRouter.put(
  '/:id',
  upload.single('image'),
  celebrate(
    {
      body: Joi.object().keys({
        name: Joi.string().required(),
        email: Joi.string().required().email(),
        whatsapp: Joi.string().required(),
        latitude: Joi.number().required(),
        longitude: Joi.number().required(),
        city: Joi.string().required(),
        uf: Joi.string().required().max(2),
        items: Joi.string().required(),
      }),
    },
    {
      abortEarly: false,
    },
  ),
  pointsController.update,
);
Example #13
Source File: providers.routes.ts    From GoBarber with MIT License 6 votes vote down vote up
providersRouter.get(
  '/:provider_id/day-availability',
  celebrate({
    [Segments.PARAMS]: {
      provider_id: Joi.string().uuid().required(),
    },
  }),
  providersDayAvailabilityController.index,
);
Example #14
Source File: password.routes.ts    From GoBarber with MIT License 6 votes vote down vote up
passwordRouter.post(
  '/forgot',
  celebrate({
    [Segments.BODY]: {
      email: Joi.string().email().required(),
    },
  }),
  forgotPasswordController.create,
);
Example #15
Source File: password.routes.ts    From GoBarber with MIT License 6 votes vote down vote up
passwordRouter.post(
  '/reset',
  celebrate({
    [Segments.BODY]: {
      token: Joi.string().uuid().required(),
      password: Joi.string().required(),
      passwordConfirmation: Joi.string().valid(Joi.ref('password')),
    },
  }),
  resetPasswordController.create,
);
Example #16
Source File: profile.routes.ts    From GoBarber with MIT License 6 votes vote down vote up
profileRouter.put(
  '/',
  celebrate({
    [Segments.BODY]: {
      name: Joi.string().required(),
      email: Joi.string().required(),
      oldPassword: Joi.string(),
      password: Joi.string().when('oldPassword', {
        is: String,
        then: Joi.string().required(),
      }),
      passwordConfirmation: Joi.string().when('oldPassword', {
        is: String,
        then: Joi.string().required().valid(Joi.ref('password')),
      }),
    },
  }),
  profileController.update,
);
Example #17
Source File: sessions.routes.ts    From GoBarber with MIT License 6 votes vote down vote up
sessionsRouter.post(
  '/',
  celebrate({
    [Segments.BODY]: {
      email: Joi.string().email().required(),
      password: Joi.string().required(),
    },
  }),
  sessionsController.create,
);
Example #18
Source File: users.routes.ts    From GoBarber with MIT License 6 votes vote down vote up
usersRouter.post(
  '/',
  celebrate({
    [Segments.BODY]: {
      name: Joi.string().required(),
      email: Joi.string().email().required(),
      password: Joi.string().min(6).required(),
    },
  }),
  usersController.create,
);
Example #19
Source File: routes.ts    From nlw-ecoleta with MIT License 6 votes vote down vote up
routes.post(
    '/points', 
    upload.single('image'), 
    celebrate({
        body: Joi.object().keys({
            name: Joi.string().required(),
            email: Joi.string().required(),
            whatsapp: Joi.number().required(),
            latitude: Joi.number().required(),
            longitude: Joi.number().required(),
            city: Joi.string().required(),
            uf: Joi.string().required(),
            items: Joi.string().required(),
    })
}, {
    abortEarly: false
}),
    pointsController.create
);
Example #20
Source File: routes.ts    From nlw-01-omnistack with MIT License 6 votes vote down vote up
routes.post(
  '/points', 
  upload.single('image'), 
  celebrate({
    body: Joi.object().keys({
      name: Joi.string().required(),
      email: Joi.string().required().email(),
      whatsapp: Joi.number().required(),
      latitude: Joi.number().required(),
      longitude: Joi.number().required(),
      city: Joi.string().required(),
      uf: Joi.string().required().max(2),
      items: Joi.string().required(),
    })
  }, {
    abortEarly: false
  }),
  pointsController.create
);
Example #21
Source File: routes.ts    From ecoleta with MIT License 6 votes vote down vote up
routes.post(
  '/points',
  upload.single('image'),
  celebrate(
    {
      body: Joi.object().keys({
        name: Joi.string().required(),
        email: Joi.string().required().email(),
        whatsapp: Joi.number().required(),
        latitude: Joi.number().required(),
        longitude: Joi.number().required(),
        city: Joi.string().required(),
        uf: Joi.string().required(),
        items: Joi.string().required(),
      }),
    },
    {
      abortEarly: false,
    }
  ),
  pointsController.create
);
Example #22
Source File: routes.ts    From ecoleta with MIT License 6 votes vote down vote up
routes.post(
  '/points', 
  upload.single('image'),
  celebrate({
    body: Joi.object().keys({
      name: Joi.string().required(),
      email: Joi.string().required().email(),
      whatsapp: Joi.number().required(),
      latitude: Joi.number().required(),
      longitude: Joi.number().required(),
      city: Joi.number().required(),
      uf: Joi.number().required().max(2),
      items: Joi.string().required()
    })
  }, {
    abortEarly: false
  }), 
  pointsController.create
);
Example #23
Source File: points.routes.ts    From ecoleta with MIT License 6 votes vote down vote up
pointsRouter.post(
  '/',
  upload.single('image'),
  celebrate(
    {
      body: Joi.object().keys({
        name: Joi.string().required(),
        email: Joi.string().required().email(),
        whatsapp: Joi.string().required(),
        latitude: Joi.number().required(),
        longitude: Joi.number().required(),
        city: Joi.string().required(),
        uf: Joi.string().required().max(2),
        items: Joi.string().required(),
      }),
    },
    {
      abortEarly: false,
    },
  ),
  pointsController.create,
);
Example #24
Source File: appointments.routes.ts    From gobarber-api with MIT License 6 votes vote down vote up
appointmentsRouter.post(
  '/',
  celebrate({
    [Segments.BODY]: {
      provider_id: Joi.string().uuid().required(),
      date: Joi.date().required(),
    },
  }),
  appointmentsController.craete,
);
Example #25
Source File: providers.routes.ts    From gobarber-api with MIT License 6 votes vote down vote up
providersRouter.get(
  '/:provider_id/day-availability',
  celebrate({
    [Segments.PARAMS]: {
      provider_id: Joi.string().uuid().required(),
    },
  }),
  providerDayAvailabilityController.index,
);
Example #26
Source File: providers.routes.ts    From gobarber-api with MIT License 6 votes vote down vote up
providersRouter.get(
  '/:provider_id/month-availability',
  celebrate({
    [Segments.PARAMS]: {
      provider_id: Joi.string().uuid().required(),
    },
  }),
  providerMonthAvailabilityController.index,
);
Example #27
Source File: passwords.routes.ts    From gobarber-api with MIT License 6 votes vote down vote up
passwordsRouter.post(
  '/forgot',
  celebrate({
    [Segments.BODY]: {
      email: Joi.string().email().required(),
    },
  }),
  forgotPasswordController.create,
);
Example #28
Source File: passwords.routes.ts    From gobarber-api with MIT License 6 votes vote down vote up
passwordsRouter.post(
  '/reset',
  celebrate({
    [Segments.BODY]: {
      token: Joi.string().uuid().required(),
      password: Joi.string().required(),
      password_confirmation: Joi.string().required().valid(Joi.ref('password')),
    },
  }),
  resetPasswordController.create,
);
Example #29
Source File: profiles.routes.ts    From gobarber-api with MIT License 6 votes vote down vote up
profilesRouter.put(
  '/',
  celebrate({
    [Segments.BODY]: {
      name: Joi.string().required(),
      email: Joi.string().email().required(),
      old_password: Joi.string(),
      password: Joi.string(),
      password_confirmation: Joi.string().valid(Joi.ref('password')),
    },
  }),
  profileController.update,
);