intermoni

package module
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 12 Imported by: 6

README

backend-intermoni

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteOneDoc

func DeleteOneDoc(_id primitive.ObjectID, db *mongo.Database, col string) error

func Encode

func Encode(id primitive.ObjectID, role, privateKey string) (string, error)

func GCFReturnStruct

func GCFReturnStruct(DataStuct any) string

return struct

func GenerateKey

func GenerateKey() (privateKey, publicKey string)

func GetAllDocs

func GetAllDocs(db *mongo.Database, col string, docs interface{}) interface{}

crud

func GetID

func GetID(r *http.Request) string

get id

func InsertOneDoc

func InsertOneDoc(db *mongo.Database, col string, doc interface{}) (insertedID primitive.ObjectID, err error)

func MongoConnect

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

mongo

func UpdateOneDoc

func UpdateOneDoc(id primitive.ObjectID, db *mongo.Database, col string, doc interface{}) (err 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"`
	Role    string `json:"role,omitempty" bson:"role,omitempty"`
}

type Magang

type Magang struct {
	ID                 primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	Posisi             string             `bson:"posisi,omitempty" json:"posisi,omitempty"`
	Mitra              Mitra              `bson:"mitra,omitempty" json:"mitra,omitempty"`
	Lokasi             string             `bson:"lokasi,omitempty" json:"lokasi,omitempty"`
	CreatedAt          primitive.DateTime `bson:"createdat,omitempty" json:"createdat,omitempty"`
	DeskripsiMagang    string             `bson:"deskripsimagang,omitempty" json:"deskripsimagang,omitempty"`
	InfoTambahanMagang string             `bson:"infotambahanmagang,omitempty" json:"infotambahanmagang,omitempty"`
	Expired            string             `bson:"expired,omitempty" json:"expired,omitempty"`
}

func GetMagangFromID

func GetMagangFromID(_id primitive.ObjectID, db *mongo.Database) (magang Magang, err error)

get magang

func GetMagangFromIDByMitra

func GetMagangFromIDByMitra(idparam, iduser primitive.ObjectID, db *mongo.Database) (magang Magang, err error)

type Mahasiswa

type Mahasiswa struct {
	ID              primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	NamaLengkap     string             `bson:"namalengkap,omitempty" json:"namalengkap,omitempty"`
	TanggalLahir    string             `bson:"tanggallahir,omitempty" json:"tanggallahir,omitempty"`
	JenisKelamin    string             `bson:"jeniskelamin,omitempty" json:"jeniskelamin,omitempty"`
	NIM             string             `bson:"nim,omitempty" json:"nim,omitempty"`
	PerguruanTinggi string             `bson:"perguruantinggi,omitempty" json:"perguruantinggi,omitempty"`
	Prodi           string             `bson:"prodi,omitempty" json:"prodi,omitempty"`
	SeleksiKampus   int                `bson:"seleksikampus,omitempty" json:"seleksikampus,omitempty"`
	Akun            User               `bson:"akun,omitempty" json:"akun,omitempty"`
}

func GetMahasiswaFromAkun

func GetMahasiswaFromAkun(id_akun primitive.ObjectID, db *mongo.Database) (doc Mahasiswa, err error)

func GetMahasiswaFromID

func GetMahasiswaFromID(_id primitive.ObjectID, db *mongo.Database) (doc Mahasiswa, err error)

get mahasiswa

type MahasiswaMagang

type MahasiswaMagang struct {
	ID               primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	Mahasiswa        Mahasiswa          `bson:"mahasiswa,omitempty" json:"mahasiswa,omitempty"`
	Magang           Magang             `bson:"magang,omitempty" json:"magang,omitempty"`
	Pembimbing       Pembimbing         `bson:"pembimbing,omitempty" json:"pembimbing,omitempty"`
	Mentor           Mentor             `bson:"mentor,omitempty" json:"mentor,omitempty"`
	SeleksiBerkas    int                `bson:"seleksiberkas,omitempty" json:"seleksiberkas,omitempty"`
	SeleksiWewancara int                `bson:"seleksiwewancara,omitempty" json:"seleksiwewancara,omitempty"`
	Status           int                `bson:"status,omitempty" json:"status,omitempty"`
}

func GetDetailMahasiswaMagangFromID

func GetDetailMahasiswaMagangFromID(_id primitive.ObjectID, db *mongo.Database) (mahasiswa_magang MahasiswaMagang, err error)

get mahasiswa_magang

func GetMahasiswaMagangFromID

func GetMahasiswaMagangFromID(_id primitive.ObjectID, db *mongo.Database) (mahasiswa_magang MahasiswaMagang, err error)

type Mentor added in v0.1.0

type Mentor struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	NamaLengkap string             `bson:"namalengkap,omitempty" json:"namalengkap,omitempty"`
	NIK         string             `bson:"nik,omitempty" json:"nik,omitempty"`
	Mitra       Mitra              `bson:"mitra,omitempty" json:"mitra,omitempty"`
	Akun        User               `bson:"akun,omitempty" json:"akun,omitempty"`
}

func GetMentorFromAkun added in v0.1.3

func GetMentorFromAkun(id_akun primitive.ObjectID, db *mongo.Database) (doc Mentor, err error)

func GetMentorFromID added in v0.1.3

func GetMentorFromID(_id primitive.ObjectID, db *mongo.Database) (doc Mentor, err error)

get mentor

type Mitra

type Mitra struct {
	ID             primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	NamaNarahubung string             `bson:"namanarahubung,omitempty" json:"namanarahubung,omitempty"`
	NoHpNarahubung string             `bson:"nohpnarahubung,omitempty" json:"nohpnarahubung,omitempty"`
	Nama           string             `bson:"nama,omitempty" json:"nama,omitempty"`
	Kategori       string             `bson:"kategori,omitempty" json:"kategori,omitempty"`
	SektorIndustri string             `bson:"sektorindustri,omitempty" json:"sektorindustri,omitempty"`
	Tentang        string             `bson:"tentang,omitempty" json:"tentang,omitempty"`
	Alamat         string             `bson:"alamat,omitempty" json:"alamat,omitempty"`
	Website        string             `bson:"website,omitempty" json:"website,omitempty"`
	MoU            int                `bson:"mou,omitempty" json:"mou,omitempty"`
	Akun           User               `bson:"akun,omitempty" json:"akun,omitempty"`
}

func GetMitraFromAkun

func GetMitraFromAkun(id_akun primitive.ObjectID, db *mongo.Database) (doc Mitra, err error)

func GetMitraFromID

func GetMitraFromID(_id primitive.ObjectID, db *mongo.Database) (doc Mitra, err error)

get mitra

type Password

type Password struct {
	Password        string `bson:"password,omitempty" json:"password,omitempty"`
	Newpassword     string `bson:"newpass,omitempty" json:"newpass,omitempty"`
	Confirmpassword string `bson:"confirmpass,omitempty" json:"confirmpass,omitempty"`
}

type Payload

type Payload struct {
	Id   primitive.ObjectID `json:"id"`
	Role string             `json:"role"`
	Exp  time.Time          `json:"exp"`
	Iat  time.Time          `json:"iat"`
	Nbf  time.Time          `json:"nbf"`
}

func Decode

func Decode(publicKey string, tokenstring string) (payload Payload, err error)

func GetUserLogin

func GetUserLogin(PASETOPUBLICKEYENV string, r *http.Request) (Payload, error)

get user login

type Pembimbing added in v0.1.0

type Pembimbing struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	NamaLengkap string             `bson:"namalengkap,omitempty" json:"namalengkap,omitempty"`
	NIK         string             `bson:"nik,omitempty" json:"nik,omitempty"`
	Prodi       string             `bson:"prodi,omitempty" json:"prodi,omitempty"`
	Akun        User               `bson:"akun,omitempty" json:"akun,omitempty"`
}

func GetPembimbingFromAkun added in v0.1.3

func GetPembimbingFromAkun(id_akun primitive.ObjectID, db *mongo.Database) (doc Pembimbing, err error)

func GetPembimbingFromID added in v0.1.3

func GetPembimbingFromID(_id primitive.ObjectID, db *mongo.Database) (doc Pembimbing, err error)

get pembimbing

type Report added in v0.1.0

type Report struct {
	ID              primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	MahasiswaMagang MahasiswaMagang    `bson:"mahasiswamagang,omitempty" json:"mahasiswamagang,omitempty"`
	Judul           string             `bson:"judul,omitempty" json:"judul,omitempty"`
	Isi             string             `bson:"isi,omitempty" json:"isi,omitempty"`
	Penerima        User               `bson:"penerima,omitempty" json:"penerima,omitempty"`
	CreatedAt       primitive.DateTime `bson:"createdat,omitempty" json:"createdat,omitempty"`
}

func GetReportFromID added in v0.1.3

func GetReportFromID(_id primitive.ObjectID, db *mongo.Database) (report Report, err error)

get report

type Response

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

type User

type User struct {
	ID              primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	Email           string             `bson:"email,omitempty" json:"email,omitempty"`
	Password        string             `bson:"password,omitempty" json:"password,omitempty"`
	Confirmpassword string             `bson:"confirmpass,omitempty" json:"confirmpass,omitempty"`
	Salt            string             `bson:"salt,omitempty" json:"salt,omitempty"`
	Role            string             `bson:"role,omitempty" json:"role,omitempty"`
}

func GetUserFromEmail

func GetUserFromEmail(email string, db *mongo.Database) (doc User, err error)

func GetUserFromID

func GetUserFromID(_id primitive.ObjectID, db *mongo.Database) (doc User, err error)

get user

Jump to

Keyboard shortcuts

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