123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- package specialAPIModels
- import (
- I "devel.mephi.ru/dyokunev/wwwvoip/app/iface"
- "github.com/revel/revel"
- "voip/app/models"
- )
- type Appointment struct {
- common
- PersonId int `json:"person_id,omitempty"`
- UnitId int `json:"unit_id,omitempty"`
- Name string `json:",omitempty"`
- Line string `json:",omitempty"`
- Description string `json:",omitempty"`
- Room string `json:",omitempty"`
- }
- type Appointments []Appointment
- func (appointments *Appointments) IConvert(apiHost string, affiliateUnit *models.Unit) (I.Slice, error) {
- var convertedAppointments models.Appointments
- for idx := range *appointments {
- appointment := &(*appointments)[idx]
- revel.TRACE.Printf("appointment == %v", appointment)
- var convertedAppointment models.Appointment
- {
- personId := appointment.PersonId
- unitId := appointment.UnitId
- appointmentId := appointment.Id
- convertedAppointment = models.Appointment{
- SourceAPIHost: &apiHost,
- SpecialAPIId: &appointmentId,
- SpecialAPIPersonId: &personId,
- SpecialAPIUnitId: &unitId,
- Name: appointment.Name,
- Description: appointment.Description,
- LineKey: appointment.Line,
- RoomKey: models.Room{RootUnitKey: (*affiliateUnit).CodeStr, Name: appointment.Room}.GetRoomKey(),
- StfCardId: -(affiliateUnit.Code.Mid*100000 + appointment.Id%100000),
- SecurityLevel0: -50,
- SecurityLevel1: -50,
- }
- }
- if convertedAppointment.LineKey == "" {
- convertedAppointment.SecurityLevel0 = 111
- convertedAppointment.SecurityLevel1 = 111
- }
- convertedAppointments = append(convertedAppointments, convertedAppointment)
- }
- return convertedAppointments, nil
- }
|