gisbdg

package module
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 15 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"
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Autorisasi added in v1.1.6

func Autorisasi(publickey, 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(MONGOCONNSTRING, dbname, collectionname string, tempat TempatWisata) error

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 DeleteWisata added in v1.1.1

func DeleteWisata(MONGOCONNSTRING, dbname, collectionname string, filter bson.D) error

func Encode added in v1.1.6

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

func GCFHandler

func GCFHandler(MONGOCONNSTRINGENV, dbname, collectionname string) string

func GCFPostHandler

func GCFPostHandler(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 HashPassword

func HashPassword(password string) (string, error)

func IsPasswordValid

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

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 UpdateWisata added in v1.1.1

func UpdateWisata(MONGOCONNSTRING, dbname, collectionname string, filter bson.D, update bson.D) error

Types

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"`
}

func GetAllBangunanLineString

func GetAllBangunanLineString(mongoconn *mongo.Database, collection string) []GeoJson

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 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 {
	User string    `json:"user"`
	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"`
	Jenis     string  `json:"jenis"`
	Deskripsi string  `json:"deskripsi"`
	Lokasi    Lokasi  `json:"lokasi"`
	Alamat    string  `json:"alamat"`
	Gambar    string  `json:"gambar"`
	Rating    float64 `json:"rating"`
}

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)

func ReadWisata added in v1.1.1

func ReadWisata(MONGOCONNSTRING, dbname, collectionname string) ([]TempatWisata, error)

type User

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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