dev.azure.com/aidainnovazione0090/DeviceManager/_git/go-mod-core-contracts@v1.0.2/dtos/organization.go (about)

     1  package dtos
     2  
     3  import "dev.azure.com/aidainnovazione0090/DeviceManager/_git/go-mod-core-contracts/models"
     4  
     5  type Organization struct {
     6  	DBTimestamp `json:",inline"`
     7  	Id          string `json:"id,omitempty" validate:"omitempty,uuid"`
     8  	Name        string `json:"name" validate:"required,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
     9  }
    10  
    11  type UpdateOrganization struct {
    12  	Id   string `json:"id,omitempty" validate:"omitempty,uuid"`
    13  	Name string `json:"name" validate:"required,edgex-dto-none-empty-string,edgex-dto-rfc3986-unreserved-chars"`
    14  }
    15  
    16  // ToOrganizationModel transforms the Organization DTO to the Organization Model
    17  func ToOrganizationModel(dto Organization) models.Organization {
    18  	var d models.Organization
    19  	d.Id = dto.Id
    20  	d.Name = dto.Name
    21  
    22  	return d
    23  }
    24  
    25  // FromDeviceModelToDTO transforms the Device Model to the Device DTO
    26  func FromOrganizationModelToDTO(d models.Organization) Organization {
    27  	var dto Organization
    28  	dto.DBTimestamp = DBTimestamp(d.DBTimestamp)
    29  	dto.Id = d.Id
    30  	dto.Name = d.Name
    31  
    32  	return dto
    33  }
    34  
    35  // UpdateDevice and its properties are defined in the APIv2 specification:
    36  // https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.1.0#/UpdateDevice