gisbdg

package module
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 18 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 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 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 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 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 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 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 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 SetConnection

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

func SignupGCF added in v1.1.0

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

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

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 ReadSemuaUser added in v1.3.5

func ReadSemuaUser(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