From 002155d57dabd29103f780ba0800686418b7d914 Mon Sep 17 00:00:00 2001 From: Nino van Galen Date: Thu, 4 Jun 2020 22:22:56 +0200 Subject: [PATCH] feat: Added attachment dtos --- lib/domain/dtos/GetAllLogAttachmentsDto.js | 32 +++++++++++++++++++++ lib/domain/dtos/GetAttachmentDto.js | 31 ++++++++++++++++++++ lib/domain/dtos/GetLogAttachmentDto.js | 33 ++++++++++++++++++++++ lib/domain/dtos/index.js | 6 ++++ 4 files changed, 102 insertions(+) create mode 100644 lib/domain/dtos/GetAllLogAttachmentsDto.js create mode 100644 lib/domain/dtos/GetAttachmentDto.js create mode 100644 lib/domain/dtos/GetLogAttachmentDto.js diff --git a/lib/domain/dtos/GetAllLogAttachmentsDto.js b/lib/domain/dtos/GetAllLogAttachmentsDto.js new file mode 100644 index 0000000000..a0c5287148 --- /dev/null +++ b/lib/domain/dtos/GetAllLogAttachmentsDto.js @@ -0,0 +1,32 @@ +/** + * @license + * Copyright CERN and copyright holders of ALICE O2. This software is + * distributed under the terms of the GNU General Public License v3 (GPL + * Version 3), copied verbatim in the file "COPYING". + * + * See http://alice-o2.web.cern.ch/license for full licensing information. + * + * In applying this license CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization + * or submit itself to any jurisdiction. + */ + +const Joi = require('@hapi/joi'); +const EntityIdDto = require('./EntityIdDto'); + +const QueryDto = Joi.object({ + mimetype: Joi.string(), + token: Joi.string(), +}); + +const ParamsDto = Joi.object({ + logId: EntityIdDto, +}); + +const GetAllLogAttachmentsDto = Joi.object({ + body: Joi.object({}), + query: QueryDto, + params: ParamsDto, +}); + +module.exports = GetAllLogAttachmentsDto; diff --git a/lib/domain/dtos/GetAttachmentDto.js b/lib/domain/dtos/GetAttachmentDto.js new file mode 100644 index 0000000000..29a26b3c15 --- /dev/null +++ b/lib/domain/dtos/GetAttachmentDto.js @@ -0,0 +1,31 @@ +/** + * @license + * Copyright CERN and copyright holders of ALICE O2. This software is + * distributed under the terms of the GNU General Public License v3 (GPL + * Version 3), copied verbatim in the file "COPYING". + * + * See http://alice-o2.web.cern.ch/license for full licensing information. + * + * In applying this license CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization + * or submit itself to any jurisdiction. + */ + +const Joi = require('@hapi/joi'); +const EntityIdDto = require('./EntityIdDto'); + +const QueryDto = Joi.object({ + token: Joi.string(), +}); + +const ParamsDto = Joi.object({ + id: EntityIdDto, +}); + +const GetLogAttachmentDto = Joi.object({ + body: Joi.object({}), + query: QueryDto, + params: ParamsDto, +}); + +module.exports = GetLogAttachmentDto; diff --git a/lib/domain/dtos/GetLogAttachmentDto.js b/lib/domain/dtos/GetLogAttachmentDto.js new file mode 100644 index 0000000000..9de6b16b82 --- /dev/null +++ b/lib/domain/dtos/GetLogAttachmentDto.js @@ -0,0 +1,33 @@ +/** + * @license + * Copyright CERN and copyright holders of ALICE O2. This software is + * distributed under the terms of the GNU General Public License v3 (GPL + * Version 3), copied verbatim in the file "COPYING". + * + * See http://alice-o2.web.cern.ch/license for full licensing information. + * + * In applying this license CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization + * or submit itself to any jurisdiction. + */ + +const Joi = require('@hapi/joi'); +const EntityIdDto = require('./EntityIdDto'); + +const ParamsDto = Joi.object({ + logId: EntityIdDto.required(), + attachmentId: EntityIdDto.required(), +}); + +const QueryDto = Joi.object({ + mimetype: Joi.string(), + token: Joi.string(), +}); + +const GetLogAttachmentDto = Joi.object({ + body: Joi.object({}), + params: ParamsDto, + query: QueryDto, +}); + +module.exports = GetLogAttachmentDto; diff --git a/lib/domain/dtos/index.js b/lib/domain/dtos/index.js index 8b67f2c158..edeaddb8e6 100644 --- a/lib/domain/dtos/index.js +++ b/lib/domain/dtos/index.js @@ -17,10 +17,13 @@ const CreateLogDto = require('./CreateLogDto'); const CreateSubsystemDto = require('./CreateSubsystemDto'); const CreateTagDto = require('./CreateTagDto'); const EntityIdDto = require('./EntityIdDto'); +const GetAllLogAttachmentsDto = require('./GetAllLogAttachmentsDto'); const GetAllLogsDto = require('./GetAllLogsDto'); const GetAllSubsystemsDto = require('./GetAllSubsystemsDto'); const GetAllTagsDto = require('./GetAllTagsDto'); +const GetAttachmentDto = require('./GetAttachmentDto'); const GetLogDto = require('./GetLogDto'); +const GetLogAttachmentDto = require('./GetLogAttachmentDto'); const GetSubsystemDto = require('./GetSubsystemDto'); const GetTagDto = require('./GetTagDto'); const PaginationDto = require('./PaginationDto'); @@ -32,10 +35,13 @@ module.exports = { CreateSubsystemDto, CreateTagDto, EntityIdDto, + GetAllLogAttachmentsDto, GetAllLogsDto, GetAllSubsystemsDto, GetAllTagsDto, + GetAttachmentDto, GetLogDto, + GetLogAttachmentDto, GetSubsystemDto, GetTagDto, PaginationDto,