mongodb

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: Unlicense Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOrderToContext

func AddOrderToContext(ctx context.Context, order Order) context.Context

AddOrderToContext adds order data to context

func CollectionConfig

func CollectionConfig(ctx context.Context) (*mongo.Collection, error)

func CollectionInvoices

func CollectionInvoices(ctx context.Context) (*mongo.Collection, error)

func CollectionOrders

func CollectionOrders(ctx context.Context) (*mongo.Collection, error)

func CollectionResult

func CollectionResult(ctx context.Context) (*mongo.Collection, error)

func Disconnect

func Disconnect(ctx context.Context)

Disconnect disconnects from db

func UpdateFromPatch

func UpdateFromPatch(req rest.PatchRequest) (interface{}, error)

UpdateFromPatch convert JSON Patch to mongodb update object

Types

type Applicant

type Applicant struct {
	FirstName        string `bson:"firstName" json:"firstName"`
	LastName         string `bson:"lastName" json:"lastName"`
	DateOfBirth      string `bson:"dateOfBirth" json:"dateOfBirth"`
	Sex              string `bson:"sex" json:"sex"`
	Nationality      string `bson:"nationality" json:"nationality"`
	PassportNumber   string `bson:"passportNumber" json:"passportNumber"`
	PassportExpiry   string `bson:"passportExpiry" json:"passportExpiry"`
	RegistrationCode string `bson:"registrationCode" json:"registrationCode"`
	Email            string `bson:"email" json:"email"`

	VisaS3Key    string `bson:"visaS3Key" json:"visaS3Key"`
	VisaSent     bool   `bson:"visaSent" json:"visaSent"`
	CancelReason string `bson:"cancelReason" json:"cancelReason"`
}

type Billing

type Billing struct {
	FirstName string `bson:"firstName" json:"firstName"`
	LastName  string `bson:"lastName" json:"lastName"`
	Email     string `bson:"email" json:"email"`
	Email2    string `bson:"email2" json:"email2"`
	Phone     string `bson:"phone" json:"phone"`
}

type Config

type Config struct {
	ID                              primitive.ObjectID `bson:"_id" json:"id"`
	PusherAppID                     string             `bson:"pusherAppId" json:"pusherAppId"`
	PusherAppKey                    string             `bson:"pusherAppKey" json:"pusherAppKey"`
	PusherAppSecret                 string             `bson:"pusherAppSecret" json:"pusherAppSecret"`
	PusherCluster                   string             `bson:"pusherCluster" json:"pusherCluster"`
	AdminDomain                     string             `bson:"adminDomain" json:"adminDomain"`
	CustomerDomain                  string             `bson:"customerDomain" json:"customerDomain"`
	EmailCustomerCC                 string             `bson:"emailCustomerCc" json:"emailCustomerCc"`
	EmailCustomerTemplateID         int                `bson:"emailCustomerTemplateId" json:"emailCustomerTemplateId"`
	EmailPartner                    string             `bson:"emailPartner" json:"emailPartner"`
	EmailPartnerCC                  string             `bson:"emailPartnerCc" json:"emailPartnerCc"`
	EmailPartnerTemplateID          int                `bson:"emailPartnerTemplateId" json:"emailPartnerTemplateId"`
	PriorityEmailCustomerTemplateID int                `bson:"priorityEmailCustomerTemplateId" json:"priorityEmailCustomerTemplateId"`
	PriorityEmailPartnerTemplateID  int                `bson:"priorityEmailPartnerTemplateId" json:"priorityEmailPartnerTemplateId"`
	APIRoot                         string             `bson:"apiRoot" json:"apiRoot"`
	APIKey                          string             `bson:"apiKey" json:"apiKey"`
}

func GetConfig

func GetConfig(ctx context.Context) (*Config, error)

type Invoice

type Invoice struct {
	ID    primitive.ObjectID `bson:"_id" json:"id"`
	Items []InvoiceItem      `bson:"items" json:"items"`
	Title string             `bson:"title" json:"title"`

	CreatedAt time.Time `bson:"createdAt" json:"createdAt"`
	UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"`
}

type InvoiceItem

type InvoiceItem struct {
	ID             primitive.ObjectID `bson:"_id" json:"id"`
	PassportNumber string             `bson:"passportNumber" json:"passportNumber"`
	Name           string             `bson:"name" json:"name"`
	Country        string             `bson:"country" json:"country"`
	Service        string             `bson:"service" json:"service"`
	OrderDate      string             `bson:"orderDate" json:"orderDate"`
	ArrivalDate    string             `bson:"arrivalDate" json:"arrivalDate"`
	Port           string             `bson:"port" json:"port"`
	Cost           string             `bson:"cost" json:"cost"`

	Found   bool   `bson:"found" json:"found"`
	Comment string `bson:"comment" json:"comment"`
}

type Order

type Order struct {
	ID                 primitive.ObjectID `bson:"_id" json:"id"`
	OrderID            int                `bson:"orderId" json:"orderId"`
	Total              string             `bson:"total" json:"total"`
	OrderKey           string             `bson:"orderKey" json:"orderKey"`
	Billing            Billing            `bson:"billing" json:"billing"`
	PaymentMethodTitle string             `bson:"paymentMethodTitle" json:"paymentMethodTitle"`
	Number             string             `bson:"number" json:"number"`
	Trip               Trip               `bson:"trip" json:"trip"`
	Applicants         []Applicant        `bson:"applicants" json:"applicants"`
	Type               OrderType          `bson:"type" json:"type"`

	AllVisaSent  bool      `bson:"allVisaSent" json:"allVisaSent"`
	InvoiceDocID string    `bson:"invoiceDocId" json:"invoiceDocId"`
	CreatedAt    time.Time `bson:"createdAt" json:"createdAt"`
	UpdatedAt    time.Time `bson:"updatedAt" json:"updatedAt"`
}

type OrderType added in v2.1.8

type OrderType string
const (
	OrderTypeVisa     OrderType = ""
	OrderTypePriority OrderType = "Priority"
)

type Result

type Result struct {
	ID       primitive.ObjectID `bson:"_id" json:"id"`
	S3DirKey string             `bson:"s3DirKey" json:"s3DirKey"`
	Files    []ResultFile       `bson:"files" json:"files"`

	CreatedAt time.Time `bson:"createdAt" json:"createdAt"`
	UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"`
}

type ResultFile

type ResultFile struct {
	Name         string `bson:"name" json:"name"`
	Processed    bool   `bson:"processed" json:"processed"`
	ErrorMessage string `bson:"errorMessage" json:"errorMessage"`
	OrderNumber  string `bson:"orderNumber" json:"orderNumber"`
	// PassportNumber used to match CV manually
	PassportNumber string `bson:"passportNumber" json:"passportNumber"`
}

type Trip

type Trip struct {
	// ArrivalDate is the raw value from woocommerce order
	ArrivalDate      string `bson:"arrivalDate" json:"arrivalDate"`
	Checkpoint       string `bson:"checkpoint" json:"checkpoint"`
	ProcessingTime   string `bson:"processingTime" json:"processingTime"`
	FastTrack        string `bson:"fastTrack" json:"fastTrack"`
	CarPickup        bool   `bson:"carPickup" json:"carPickup"`
	Flight           string `bson:"flight" json:"flight"`
	CarPickupAddress string `bson:"carPickupAddress" json:"carPickupAddress"`

	// Arrival is the parsed value from ArrivalDate
	Arrival time.Time `bson:"arrival" json:"arrival"`
}

Jump to

Keyboard shortcuts

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