How to use the italia-ts-commons/lib/types.pick function in italia-ts-commons

To help you get started, we’ve selected a few italia-ts-commons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github teamdigitale / io-functions / lib / compute_visible_services.ts View on Github external
// if the service is not visible anymore
    // delete it from the visible services list
    return remove(service.serviceId, visibleServicesObj);
  } else if (
    // if the service is visible and we don't have a related
    // cached visible service yet...
    service.isVisible &&
    (isNone(maybeVisibleService) ||
      // ... or if the updated service is visible and the version
      // is greater than the stored version of the cached visible service
      service.version > maybeVisibleService.value.version)
  ) {
    // store the visible service into the object (map)
    return insert(
      service.serviceId,
      pick(
        [
          "departmentName",
          "id",
          "organizationFiscalCode",
          "organizationName",
          "serviceId",
          "serviceName",
          "version"
        ],
        service
      ),
      visibleServicesObj
    );
  }
  return visibleServicesObj;
}
github teamdigitale / io-functions / lib / models / message_status.ts View on Github external
function toBaseType(o: RetrievedMessageStatus): MessageStatus {
  return pick(["messageId", "status", "updatedAt"], o);
}
github teamdigitale / io-functions / lib / models / notification.ts View on Github external
function toBaseType(o: RetrievedNotification): Notification {
  return pick(["fiscalCode", "messageId", "channels"], o);
}
github teamdigitale / io-functions / lib / models / service.ts View on Github external
function toBaseType(o: RetrievedService): Service {
  return pick(
    [
      "authorizedCIDRs",
      "authorizedRecipients",
      "departmentName",
      "isVisible",
      "maxAllowedPaymentAmount",
      "organizationFiscalCode",
      "organizationName",
      "serviceId",
      "serviceName"
    ],
    o
  );
}
github teamdigitale / io-functions / lib / models / sender_service.ts View on Github external
function toBaseType(o: RetrievedSenderService): SenderService {
  return pick(
    [
      "lastNotificationAt",
      SENDER_SERVICE_MODEL_PK_FIELD,
      "serviceId",
      "version"
    ],
    o
  );
}
github teamdigitale / io-functions / lib / models / message.ts View on Github external
function toBaseType(o: RetrievedMessage): Message {
  const props: ReadonlyArray = [
    "fiscalCode",
    "senderServiceId",
    "senderUserId",
    "timeToLiveSeconds",
    "createdAt"
  ];
  return RetrievedMessageWithContent.is(o)
    ? pick(["content", ...props], o)
    : pick(props, o);
}
github teamdigitale / io-functions / lib / models / message.ts View on Github external
function toBaseType(o: RetrievedMessage): Message {
  const props: ReadonlyArray = [
    "fiscalCode",
    "senderServiceId",
    "senderUserId",
    "timeToLiveSeconds",
    "createdAt"
  ];
  return RetrievedMessageWithContent.is(o)
    ? pick(["content", ...props], o)
    : pick(props, o);
}
github teamdigitale / io-functions / lib / models / notification_status.ts View on Github external
function toBaseType(o: RetrievedNotificationStatus): NotificationStatus {
  return pick(
    [
      "channel",
      "messageId",
      "notificationId",
      "status",
      "statusId",
      "updatedAt"
    ],
    o
  );
}