port

package module
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: MIT Imports: 13 Imported by: 0

README

portsafebackend

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func CompareNipp added in v0.0.51

func CompareNipp(MongoConn *mongo.Database, Colname, nipp string) bool

func DecodeGetRole added in v0.0.51

func DecodeGetRole(PublicKey, tokenStr string) (pay string, err error)

func DecodeGetRoleandUser added in v0.0.51

func DecodeGetRoleandUser(PublicKey, tokenStr string) (pay string, use string)

func DecodeGetUser added in v0.0.51

func DecodeGetUser(PublicKey, tokenStr string) (pay string, err error)

func DeleteReport added in v0.0.44

func DeleteReport(Mongoenv, publickey, dbname, colname string, r *http.Request) string

func DeleteReportData added in v0.0.56

func DeleteReportData(mongoconn *mongo.Database, colname, Repid string) (deletedid interface{}, err error)

func DeleteUser added in v0.0.38

func DeleteUser(Mongoconn *mongo.Database, colname, nipp string) (deleted interface{}, err error)

func DeleteUserforAdmin added in v0.0.51

func DeleteUserforAdmin(Mongoenv, publickey, dbname, colname string, r *http.Request) string

func EncodeWithRole added in v0.0.51

func EncodeWithRole(role, nipp, privatekey string) (string, error)

func GCFReturnStruct

func GCFReturnStruct(DataStuct any) string

func GetAllReport added in v0.0.56

func GetAllReport(PublicKey, Mongoenv, dbname, colname string, r *http.Request) string

func GetAllReportByUser added in v1.1.13

func GetAllReportByUser(PublicKey, Mongoenv, dbname, colname string, r *http.Request) string

func GetDataUser added in v1.1.6

func GetDataUser(PublicKey, MongoEnv, dbname, colname string, r *http.Request) string

func GetOneReport added in v0.0.56

func GetOneReport(PublicKey, MongoEnv, dbname, colname string, r *http.Request) string

func HashPassword

func HashPassword(password string) (string, error)

func InsertDataReport added in v0.0.53

func InsertDataReport(Publickey, MongoEnv, dbname, colname string, r *http.Request) string

func InsertOneDoc added in v0.0.51

func InsertOneDoc(db *mongo.Database, collection string, doc interface{}) (insertedID interface{})

func InsertReport added in v0.0.56

func InsertReport(MongoConn *mongo.Database, colname string, rpt Report) (InsertedID interface{})

func InsertUserdata added in v0.0.51

func InsertUserdata(MongoConn *mongo.Database, nipp, nama, jabatan, divisi, bidang, password, role string) (InsertedID interface{})

func IsAdmin added in v0.0.51

func IsAdmin(Tokenstr, PublicKey string) bool

func IsUser added in v0.0.51

func IsUser(TokenStr, Publickey string) bool

func Login added in v0.0.51

func Login(Privatekey, MongoEnv, dbname, Colname string, r *http.Request) string

func PasswordValidator added in v0.0.51

func PasswordValidator(MongoConn *mongo.Database, colname string, userdata User) bool

func Register added in v0.0.51

func Register(Mongoenv, dbname string, r *http.Request) string

func ResetPassword added in v0.0.51

func ResetPassword(MongoEnv, publickey, dbname, colname string, r *http.Request) string

func SetConnection

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

func TokenEncoder added in v0.0.51

func TokenEncoder(username, privatekey string) string

func UpdateDataReport added in v0.0.56

func UpdateDataReport(Publickey, MongoEnv, dbname, colname string, r *http.Request) string

func UpdatePassword added in v0.0.51

func UpdatePassword(mongoconn *mongo.Database, user User) (Updatedid interface{})

func UpdateReport added in v0.0.56

func UpdateReport(Mongoconn *mongo.Database, ctx context.Context, emp Report) (UpdateId interface{}, err error)

Types

type Area added in v0.0.53

type Area struct {
	AreaId   string `json:"areaId" bson:"areaId"`
	AreaName string `json:"areaName" bson:"areaName"`
}

func GetAreaByName added in v0.1.1

func GetAreaByName(MongoConn *mongo.Database, areaName string) *Area

type Cred added in v0.0.51

type Cred struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
}

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 Location added in v0.0.58

type Location struct {
	LocationId   string `json:"locationId" bson:"locationId"`
	LocationName string `json:"locationName" bson:"locationName"`
}

func GetLocationByName added in v0.1.1

func GetLocationByName(MongoConn *mongo.Database, locationName string) *Location

type Payload added in v0.0.38

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 Decoder added in v0.0.51

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

type Report added in v0.0.44

type Report struct {
	Reportid             string                 `json:"reportid" bson:"reportid"`
	Date                 string                 `json:"date" bson:"date"`
	User                 User                   `json:"user" bson:"user,omitempty"`
	Location             Location               `json:"location" bson:"location"`
	Description          string                 `json:"description" bson:"description"`
	ObservationPhoto     string                 `json:"observationPhoto" bson:"observationPhoto"`
	TypeDangerousActions []TypeDangerousActions `json:"typeDangerousActions" bson:"typeDangerousActions,omitempty"`
	Area                 Area                   `json:"area" bson:"area"`
	ImmediateAction      string                 `json:"immediateAction" bson:"immediateAction"`
	ImprovementPhoto     string                 `json:"improvementPhoto" bson:"improvementPhoto"`
	CorrectiveAction     string                 `json:"correctiveAction" bson:"correctiveAction"`
}

func GetAllReportData added in v0.0.56

func GetAllReportData(Mongoconn *mongo.Database, colname string) []Report

func GetAllReportDataByUser added in v1.1.13

func GetAllReportDataByUser(conn *mongo.Database, colname, userID string) []Report

func GetOneReportData added in v0.0.56

func GetOneReportData(mongoconn *mongo.Database, colname, Repid string) (dest Report)

type ReqUsers added in v0.0.51

type ReqUsers struct {
	Nipp string `json:"nipp"`
}

type RequestReport added in v0.0.53

type RequestReport struct {
	Reportid string `json:"reportid"`
}

type Response added in v0.0.38

type Response struct {
	Token string `json:"token,omitempty" bson:"token,omitempty"`
}

type ResponseBack added in v0.0.53

type ResponseBack struct {
	Status  int      `json:"status"`
	Message string   `json:"message"`
	Data    []string `json:"data"`
}

type ResponseDataUser added in v0.0.51

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

type ResponseEncode added in v0.0.51

type ResponseEncode struct {
	Message string `json:"message,omitempty" bson:"message,omitempty"`
	Token   string `json:"token,omitempty" bson:"token,omitempty"`
}

type ResponseReport added in v0.0.53

type ResponseReport struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
	Data    Report `json:"data"`
}

type ResponseReportBanyak added in v0.0.53

type ResponseReportBanyak struct {
	Status  int      `json:"status"`
	Message string   `json:"message"`
	Data    []Report `json:"data"`
}

type TypeDangerousActions added in v0.0.53

type TypeDangerousActions struct {
	TypeId   string   `json:"typeId" bson:"typeId"`
	TypeName string   `json:"typeName" bson:"typeName"`
	SubTypes []string `json:"subTypes" bson:"subTypes"`
}

type User

type User struct {
	Nipp     string `json:"nipp" bson:"nipp"`
	Nama     string `json:"nama" bson:"nama"`
	Jabatan  string `json:"jabatan" bson:"jabatan"`
	Divisi   string `json:"divisi" bson:"divisi"`
	Bidang   string `json:"bidang" bson:"bidang"`
	Password string `json:"password" bson:"password"`
	Role     string `json:"role,omitempty" bson:"role,omitempty"`
}

func GetAllUser added in v0.0.51

func GetAllUser(MongoConn *mongo.Database, colname string) []User

func GetOneUser added in v0.0.51

func GetOneUser(MongoConn *mongo.Database, colname string, userdata User) User

func GetUserByNipp added in v0.1.1

func GetUserByNipp(MongoConn *mongo.Database, nipp string) (*User, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳