Skip to content

Commit

Permalink
refactor: remove unused answer fields
Browse files Browse the repository at this point in the history
  • Loading branch information
SignalRichard committed Apr 17, 2023
1 parent 07fc027 commit 487b880
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
17 changes: 0 additions & 17 deletions stackoverflow/resource_answer.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@ func resourceAnswer() *schema.Resource {
Type: schema.TypeInt,
Required: true,
},
"tags": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"title": {
Type: schema.TypeString,
Optional: true,
},
},
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
Expand All @@ -57,8 +46,6 @@ func resourceAnswerCreate(ctx context.Context, d *schema.ResourceData, meta inte
answer := &so.Answer{
BodyMarkdown: d.Get("body_markdown").(string),
QuestionID: d.Get("question_id").(int),
Title: d.Get("title").(string),
Tags: mergeDefaultTagsWithResourceTags(client.DefaultTags, expandTagsToArray(d.Get("tags").([]interface{}))),
Filter: d.Get("filter").(string),
}

Expand Down Expand Up @@ -99,8 +86,6 @@ func resourceAnswerRead(ctx context.Context, d *schema.ResourceData, meta interf
d.SetId(strconv.Itoa(answer.ID))
d.Set("body_markdown", answer.BodyMarkdown)
d.Set("question_id", answer.QuestionID)
d.Set("title", answer.Title)
d.Set("tags", ignoreDefaultTags(client.DefaultTags, answer.Tags, expandTagsToArray(d.Get("tags").([]interface{}))))

return diags
}
Expand All @@ -120,8 +105,6 @@ func resourceAnswerUpdate(ctx context.Context, d *schema.ResourceData, meta inte
ID: answerID,
BodyMarkdown: d.Get("body_markdown").(string),
QuestionID: d.Get("question_id").(int),
Title: d.Get("title").(string),
Tags: mergeDefaultTagsWithResourceTags(client.DefaultTags, expandTagsToArray(d.Get("tags").([]interface{}))),
Filter: d.Get("filter").(string),
}

Expand Down
8 changes: 6 additions & 2 deletions stackoverflow/resource_question.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ func resourceQuestion() *schema.Resource {
UpdateContext: resourceQuestionUpdate,
DeleteContext: resourceQuestionDelete,
Schema: map[string]*schema.Schema{
"title": {
"body_markdown": {
Type: schema.TypeString,
Required: true,
},
"body_markdown": {
"filter": {
Type: schema.TypeString,
Required: true,
},
Expand All @@ -33,6 +33,10 @@ func resourceQuestion() *schema.Resource {
Type: schema.TypeString,
},
},
"title": {
Type: schema.TypeString,
Required: true,
},
},
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
Expand Down

0 comments on commit 487b880

Please sign in to comment.