gisbdg

package module
v1.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 23 Imported by: 0

README

Update Library GISWisataBandung

go get -u all
go mod tidy
git tag                                 #cek riwayat versi tag
git tag v1.0.0                          #set versi tag
git push origin v1.0.0     #push tag version ke repo
go list -m github.com/urlgithubanda@v1.0.0   #publish ke PKG go Dev

go get github.com/InformasiwisataBandung/BackendGO@v1.1.0 #Jika ingin Menggunakan Package atau library

Update enkripsi Password Mongo DB, Deploy function Signup, Memasukan Token jika user berhasil login kedalam Cookies

•Update 21-10-2023

{
  "username": "ucup",
  "password": "$2a$10$r.Z8w/WHkd7uHcE6ZGlqCOcsNQEQOdXyrYYcDMMY9V4/HLOmXloCq"
}

Update 23-10-2023

-API clooud functions Signup

https://asia-southeast2-bustling-walker-340203.cloudfunctions.net/function-Signup

input

{
  "username": "username",
  "password": "Password"
}

Send Post

{
    "message": "Pendaftaran berhasil"
}

-Memasukan Token ke Cookies

cookie := http.Cookie{
		Name:     "token",     // Nama cookie
		Value:    tokenString, // Token sebagai nilai cookie
		HttpOnly: true,        // Hanya bisa diakses melalui HTTP
		Path:     "/",         // Path di mana cookie berlaku (misalnya, seluruh situs)
		MaxAge:   3600,        // Durasi cookie (dalam detik), sesuaikan sesuai kebutuhan
		// Secure: true, // Jika situs dijalankan melalui HTTPS
	}

Update 4-5 November 2023

API CreateWisata

https://us-central1-bustling-walker-340203.cloudfunctions.net/function-6CreateWisata

Input

{
  "nama": "Nama Tempat Wisata",
  "jenis": "Jenis Tempat",
  "deskripsi": "Deskripsi Tempat Wisata",
  "lokasi": {
    "latitude": 123.456789,
    "longitude": 987.654321
  },
  "alamat": "Alamat Tempat Wisata",
  "gambar": "URL_Gambar",
  "rating": 4.5
}

SendPost CreateWisata

{
    "message": "Data Create successfully"
}

API ReadWisata

https://us-central1-bustling-walker-340203.cloudfunctions.net/function-7ReadWisata

Send GET Wisata

{
    "data": [
        {
            "nama": "Nama Tempat Wisata",
            "jenis": "Jenis Tempat",
            "deskripsi": "Deskripsi Tempat Wisata",
            "lokasi": {
                "type": "",
                "coordinates": null
            },
            "alamat": "Alamat Tempat Wisata",
            "gambar": "URL_Gambar",
            "rating": 4.5
        },
        {
            "nama": "Gedung Sate",
            "jenis": "Traveling",
            "deskripsi": "Tempat Bersejarah",
            "lokasi": {
                "type": "",
                "coordinates": null
            },
            "alamat": "Alamat Tempat Wisata",
            "gambar": "URL_Gambar",
            "rating": 4.5
        }
    ]
}

API UpdateWisata

https://us-central1-bustling-walker-340203.cloudfunctions.net/function-8UpdateWisata

Input

{
  "filter": {
    "Nama": "Tempat A"
  },
  "update": {
    "$set": {
      "Deskripsi": "Deskripsi baru untuk Tempat A"
    }
  }
}

SendPost UpdateWisata

{
    "message": "Data updated successfully"
}

•Update 21-10-2023 (Fix GeoCoding)

Parameters

address = GedungSate

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddKomentar added in v1.4.5

func AddKomentar(publickey, MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

func AmbilSemuaKomentar added in v1.4.5

func AmbilSemuaKomentar(MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func CreateWisata added in v1.1.1

func CreateWisata(publickey, MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

WISATA

func CreateWisataConn added in v1.1.8

func CreateWisataConn(MONGOCONNSTRINGENV *mongo.Database, collname string, datawisata TempatWisata) interface{}

func DecodeGetRole added in v1.1.6

func DecodeGetRole(publickey string, tokenstring string) string

func DecodeGetUsername added in v1.1.6

func DecodeGetUsername(publickey string, tokenstring string) string

func DeleteKomentar added in v1.4.5

func DeleteKomentar(MONGOCONNSTRINGENV *mongo.Database, collname string, datakomentar Komentar) interface{}

func DeleteUser added in v1.2.9

func DeleteUser(publickey, MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

func DeleteWisata added in v1.1.1

func DeleteWisata(publickey, MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

func DeleteWisataConn added in v1.2.8

func DeleteWisataConn(MONGOCONNSTRINGENV *mongo.Database, collname string, datawisata TempatWisata) interface{}

func EditKomentar added in v1.4.5

func EditKomentar(MONGOCONNSTRINGENV *mongo.Database, collname string, datakomentar Komentar) interface{}

func EditUser added in v1.2.9

func EditUser(MONGOCONNSTRINGENV *mongo.Database, collname string, datauser User) interface{}

func Encode added in v1.1.6

func Encode(username, role, privatekey string) (string, error)

func GCFPostHandlerSIGN added in v1.1.7

func GCFPostHandlerSIGN(token, PASETOPRIVATEKEYENV, MONGOCONNSTRINGENV, dbname, collectionname string, r *http.Request) string

func GCFReturnStruct

func GCFReturnStruct(DataStuct any) string

func GenerateKey added in v1.1.6

func GenerateKey() (privatekey, publickey string)

func Geocode added in v1.4.3

func Geocode(address, apiKey string) (string, error)

func GeocodeHandler added in v1.4.3

func GeocodeHandler(w http.ResponseWriter, r *http.Request)

geocoding handler

func HapusKomentar added in v1.4.5

func HapusKomentar(publickey, MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

func HapusUser added in v1.2.9

func HapusUser(MONGOCONNSTRINGENV *mongo.Database, collname string, userdata User) interface{}

func HashPassword

func HashPassword(password string) (string, error)

func InsertKomentar added in v1.4.5

func InsertKomentar(MONGOCONNSTRINGENV *mongo.Database, collname string, datakomentar Komentar) interface{}

Crud Komentar Takis

func InsertUserdata added in v1.1.7

func InsertUserdata(MONGOCONNSTRINGENV *mongo.Database, collname, no_whatsapp, username, password, role string) (InsertedID interface{})

func IsPasswordValid

func IsPasswordValid(MONGOCONNSTRINGENV *mongo.Database, collection string, userdata User) bool

User

func LoginHandler added in v1.2.0

func LoginHandler(token, privatekey, MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

func NamaWisataExist added in v1.2.9

func NamaWisataExist(MONGOCONNSTRINGENV, dbname string, datawisata TempatWisata) bool

func NomorWAExists added in v1.5.3

func NomorWAExists(MONGOCONNSTRINGENV, dbname string, userdata User) bool

func Otorisasi added in v1.1.7

func Otorisasi(publickey, MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

Bagian Awal

func ReadOnWisata added in v1.2.9

func ReadOnWisata(MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

func ReadOneKomentar added in v1.4.5

func ReadOneKomentar(MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

func ReadUserHandler added in v1.2.9

func ReadUserHandler(publickey, MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

func ReadWisata added in v1.1.1

func ReadWisata(MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

GET FIX

func ReadsatuUser added in v1.2.9

func ReadsatuUser(publickey, MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

func Registrasi added in v1.1.7

func Registrasi(token, MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

func ReverseGeocode added in v1.5.0

func ReverseGeocode(lat, lng float64, apiKey string) (string, error)

Reverse Geocoding

func ReverseGeocodeHandler added in v1.5.0

func ReverseGeocodeHandler(w http.ResponseWriter, r *http.Request)

func SaveImageToMongoDB added in v1.6.9

func SaveImageToMongoDB(mconn *mongo.Database, imageBytes []byte) (string, error)

func ServeImage added in v1.6.9

func ServeImage(w http.ResponseWriter, r *http.Request)

func SetConnection

func SetConnection(MONGOCONNSTRINGENV, dbname string) *mongo.Database

func SignupGCF added in v1.1.0

func SignupGCF(w http.ResponseWriter, r *http.Request)

func UpdateKomentar added in v1.4.5

func UpdateKomentar(publickey, MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

func UpdateUser added in v1.2.9

func UpdateUser(publickey, MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

func UpdateWisata added in v1.1.1

func UpdateWisata(publickey, MONGOCONNSTRINGENV, dbname, collname string, r *http.Request) string

func UpdateWisataConn added in v1.2.8

func UpdateWisataConn(MONGOCONNSTRINGENV *mongo.Database, collname string, datawisata TempatWisata) interface{}

Types

type BeriPesan added in v1.1.7

type BeriPesan struct {
	Status  bool   `json:"status" bson:"status"`
	Message string `json:"message" bson:"message"`
	Token   string `json:"token,omitempty" bson:"token,omitempty"`
}

type Credential

type Credential struct {
	Status  bool   `json:"status" bson:"status"`
	Token   string `json:"token,omitempty" bson:"token,omitempty"`
	Message string `json:"message,omitempty" bson:"message,omitempty"`
}

type CredentialUser added in v1.1.6

type CredentialUser struct {
	Status  bool   `json:"status" bson:"status"`
	Data    User   `json:"data,omitempty" bson:"data,omitempty"`
	Message string `json:"message,omitempty" bson:"message,omitempty"`
}

type GeoJson

type GeoJson struct {
	Type       string     `json:"type" bson:"type"`
	Properties Properties `json:"properties" bson:"properties"`
	Geometry   Geometry   `json:"geometry" bson:"geometry"`
}

type GeoJsonLineString

type GeoJsonLineString struct {
	Type       string             `json:"type" bson:"type"`
	Properties Properties         `json:"properties" bson:"properties"`
	Geometry   GeometryLineString `json:"geometry" bson:"geometry"`
}

type GeoJsonPolygon

type GeoJsonPolygon struct {
	Type       string          `json:"type" bson:"type"`
	Properties Properties      `json:"properties" bson:"properties"`
	Geometry   GeometryPolygon `json:"geometry" bson:"geometry"`
}

type Geometry

type Geometry struct {
	Coordinates interface{} `json:"coordinates" bson:"coordinates"`
	Type        string      `json:"type" bson:"type"`
}

type GeometryLineString

type GeometryLineString struct {
	Coordinates [][]float64 `json:"coordinates" bson:"coordinates"`
	Type        string      `json:"type" bson:"type"`
}

type GeometryPoint

type GeometryPoint struct {
	Coordinates []float64 `json:"coordinates" bson:"coordinates"`
	Type        string    `json:"type" bson:"type"`
}

type GeometryPolygon

type GeometryPolygon struct {
	Coordinates [][][]float64 `json:"coordinates" bson:"coordinates"`
	Type        string        `json:"type" bson:"type"`
}

type Komentar added in v1.4.5

type Komentar struct {
	ID          string `json:"id" bson:"id"`
	Nama_Wisata string `json:"nama_wisata" bson:"nama_wisata"`
	Name        string `json:"name" bson:"name"`
	Tanggal     string `json:"tanggal" bson:"tanggal"`
	Komentar    string `json:"komentar" bson:"komentar"`
}

func FindKomentar added in v1.4.5

func FindKomentar(MONGOCONNSTRINGENV *mongo.Database, collname string, datakomentar Komentar) Komentar

func GetAllKomentar added in v1.4.5

func GetAllKomentar(MONGOCONNSTRINGENV *mongo.Database, collname string) []Komentar

type Lokasi added in v1.1.1

type Lokasi struct {
	Type        string    `json:"type"`
	Coordinates []float64 `json:"coordinates"`
}

type Payload added in v1.1.6

type Payload struct {
	Username string    `json:"username"`
	Role     string    `json:"role"`
	Exp      time.Time `json:"exp"`
	Iat      time.Time `json:"iat"`
	Nbf      time.Time `json:"nbf"`
}

func Decode added in v1.1.6

func Decode(publickey, tokenstr string) (payload Payload, err error)

type Properties

type Properties struct {
	Name string `json:"name" bson:"name"`
}

type SignupPayload added in v1.1.0

type SignupPayload struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type TempatWisata added in v1.1.1

type TempatWisata struct {
	Nama         string  `json:"nama"  bson:"nama"`
	Jenis        string  `json:"jenis" bson:"jenis"`
	Deskripsi    string  `json:"deskripsi" bson:"deskripsi"`
	Lokasi       Lokasi  `json:"lokasi" bson:"lokasi"`
	Alamat       string  `json:"alamat" bson:"alamat"`
	GambarID     string  `json:"gambar_id" bson:"gambar_id"` // ID gambar di MongoDB
	GambarBase64 string  `json:"gambar_base64,omitempty" bson:"-"`
	Rating       float64 `json:"rating" bson:"rating"`
}

func FindWisat added in v1.2.9

func FindWisat(MONGOCONNSTRINGENV *mongo.Database, collname string, datawisata TempatWisata) TempatWisata

func Geocoding added in v1.1.2

func Geocoding(MONGOCONNSTRINGENV, dbname, collectionname string, query string) ([]TempatWisata, error)

Geocoding (untuk menemukan lokasi dari konten yang sudah dibuat Local host)

func GetAllWisata added in v1.2.9

func GetAllWisata(MONGOCONNSTRINGENV *mongo.Database, collname string) []TempatWisata

Read All wisata

type User

type User struct {
	No_whatsapp string `json:"no_whatsapp,omitempty" bson:"no_whatsapp"`
	Username    string `json:"username" bson:"username"`
	Password    string `json:"password,omitempty" bson:"password"`
	Role        string `json:"role,omitempty" bson:"role,omitempty"`
}

func FindUser added in v1.1.9

func FindUser(MONGOCONNSTRINGENV *mongo.Database, collname string, userdata User) User

func GetAllUser added in v1.3.9

func GetAllUser(MONGOCONNSTRINGENV *mongo.Database, collname string) []User

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL