Compare commits

..

No commits in common. "98f069c94e168b22705107d716f0ba9729637b9c" and "554719f56644661d1640c54a65bbfa1c97222eb0" have entirely different histories.

2 changed files with 1 additions and 9 deletions

View File

@ -4,7 +4,6 @@ import (
"fmt"
"io"
"os"
"strconv"
"strings"
DB "log101/konulu-konum-backend/db"
@ -22,11 +21,6 @@ func KonuluKonumCreate(c *fiber.Ctx) error {
// Get form values
author := form.Value["author"][0]
description := form.Value["description"][0]
radius := form.Value["geolocation-radius"][0]
radiusInt, err := strconv.Atoi(radius)
if err != nil {
radiusInt = 50
}
// Geolocation is stored as JSON array string
geolocation := fmt.Sprintf("[%s]", form.Value["geolocation"][0])
@ -67,7 +61,7 @@ func KonuluKonumCreate(c *fiber.Ctx) error {
// Write to DB
db := DB.GetDB()
db.Create(&models.KonuluKonum{URI: imageUri, ImageURL: imageURL, Coordinates: geolocation, AuthorName: author, Description: description, UnlockedCounter: 0, Radius: radiusInt})
db.Create(&models.KonuluKonum{URI: imageUri, ImageURL: imageURL, Coordinates: geolocation, AuthorName: author, Description: description, UnlockedCounter: 0})
// Return URL
redirectURL := fmt.Sprintf("%s/x?id=%s", clientURL, imageUri)
@ -97,7 +91,6 @@ func KonuluKonumGet(c *fiber.Ctx) error {
"loc": konuluKonum.Coordinates,
"author": konuluKonum.AuthorName,
"description": konuluKonum.Description,
"radius": konuluKonum.Radius,
"unlocked_counter": konuluKonum.UnlockedCounter,
})
}

View File

@ -11,6 +11,5 @@ type KonuluKonum struct {
Coordinates string
AuthorName string
Description string
Radius int
UnlockedCounter int
}