Skip to content

Commit

Permalink
remove ticket type (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenleach authored Aug 28, 2024
1 parent 1dd29b8 commit b8097f6
Show file tree
Hide file tree
Showing 4 changed files with 400 additions and 215 deletions.
1 change: 0 additions & 1 deletion pkg/connectorbuilder/connectorbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ func (b *builderImpl) CreateTicket(ctx context.Context, request *v2.TicketsServi
DisplayName: reqBody.GetDisplayName(),
Description: reqBody.GetDescription(),
Status: reqBody.GetStatus(),
Type: reqBody.GetType(),
Labels: reqBody.GetLabels(),
CustomFields: reqBody.GetCustomFields(),
RequestedFor: reqBody.GetRequestedFor(),
Expand Down
7 changes: 0 additions & 7 deletions pkg/tasks/local/ticket.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type localCreateTicket struct {
type ticketTemplate struct {
SchemaID string `json:"schema_id"`
StatusId string `json:"status_id"`
TypeId string `json:"type_id"`
DisplayName string `json:"display_name"`
Description string `json:"description"`
Labels []string `json:"labels"`
Expand Down Expand Up @@ -91,12 +90,6 @@ func (m *localCreateTicket) Process(ctx context.Context, task *v1.Task, cc types
Labels: template.Labels,
}

if template.TypeId != "" {
ticketRequestBody.Type = &v2.TicketType{
Id: template.TypeId,
}
}

if template.StatusId != "" {
ticketRequestBody.Status = &v2.TicketStatus{
Id: template.StatusId,
Expand Down
17 changes: 0 additions & 17 deletions pkg/types/ticket/custom_fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,23 +347,6 @@ func ValidateTicket(ctx context.Context, schema *v2.TicketSchema, ticket *v2.Tic
return false, nil
}

// Validate the ticket type is one defined in the schema
// Ticket type is not required so if a ticket doesn't have a type
// we don't need to validate, skip the loop in this case
validTicketType := ticket.Type == nil
if !validTicketType {
for _, tType := range schema.GetTypes() {
if ticket.Type.GetId() == tType.GetId() {
validTicketType = true
break
}
}
}
if !validTicketType {
l.Debug("error: invalid ticket: could not find ticket type", zap.String("ticket_type_id", ticket.Type.GetId()))
return false, nil
}

schemaCustomFields := schema.GetCustomFields()
ticketCustomFields := ticket.GetCustomFields()

Expand Down
Loading

0 comments on commit b8097f6

Please sign in to comment.