package testutils import "testing" type CreateObjectRequest struct { ShortName string `json:"short_name"` LongName string `json:"long_name"` Type string `json:"type"` Phone string `json:"phone"` Email string `json:"email"` Site string `json:"site"` ShortDescription string `json:"short_description"` Description string `json:"description"` Address string `json:"address"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` IsActive bool `json:"is_active"` IsVerified bool `json:"is_verified"` } type CreateFeedbackRequest struct { ObjectID uint `json:"object_id"` Rating int `json:"rating"` Text string `json:"text"` Platform string `json:"platform"` MediaURLs []string `json:"media_urls"` } type CreateCommentRequest struct { FeedbackID uint `json:"feedback_id"` Text string `json:"text"` ParentID *uint `json:"parent_id"` } func (c *TestConfig) CreateTestObject(t *testing.T, token string) uint { req := CreateObjectRequest{ ShortName: "Test Object", LongName: "Test Object for Testing", Type: "cafe", Phone: "+71234567890", Email: "test@object.com", Site: "https://test.com", ShortDescription: "Test description", Description: "Full test description", Address: "Test Address 123", Latitude: 55.751244, Longitude: 37.618423, IsActive: true, IsVerified: false, } resp, err := c.Request("POST", "/objects", req, token) if err != nil { t.Fatalf("Failed to create test object: %v", err) } defer resp.Body.Close() var result map[string]interface{} if err := c.ParseResponse(resp, &result); err != nil { t.Fatalf("Failed to parse response: %v", err) } if id, ok := result["id"].(float64); ok { return uint(id) } t.Fatal("Failed to get object ID") return 0 } func (c *TestConfig) CreateTestFeedback(t *testing.T, token string, objectID uint) uint { req := CreateFeedbackRequest{ ObjectID: objectID, Rating: 5, Text: "Test feedback content", Platform: "tourist", } resp, err := c.Request("POST", "/feedbacks", req, token) if err != nil { t.Fatalf("Failed to create test feedback: %v", err) } defer resp.Body.Close() var result map[string]interface{} if err := c.ParseResponse(resp, &result); err != nil { t.Fatalf("Failed to parse response: %v", err) } if id, ok := result["id"].(float64); ok { return uint(id) } t.Fatal("Failed to get feedback ID") return 0 }