server

package
v0.0.0-...-d0a0e58 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustGetToken

func MustGetToken(c *gin.Context) *jwttoken.JwtPayload

Types

type AddressIdParam

type AddressIdParam struct {
	AddressId string `json:"address_id" form:"address_id" binding:"required,addressid" example:"f01624861"`
}

type AdminLoginUser

type AdminLoginUser struct {
	ClientId     string    `json:"client_id"`
	RefreshToken string    `json:"refresh_token"`
	AccessToken  string    `json:"access_token"`
	Uid          uuid.UUID `json:"uid"`
	Type         string    `json:"type"`
	Name         string    `json:"name"`
	Avatar       string    `json:"avatar"`
}

type AdminUserParam

type AdminUserParam struct {
	Name     string `json:"name" binding:"required" example:"filfind"`
	Password string `json:"password" binding:"required,password" example:"filFind123"`
}

type ClientDetailParams

type ClientDetailParams struct {
	Bandwidth          string `json:"bandwidth" binding:"omitempty,max=128" example:"300M"`
	MonthlyStorage     string `json:"monthly_storage" binding:"omitempty,max=128" example:"10TiB"`
	UseCase            string `json:"use_case" binding:"omitempty,max=128" example:"Entertainment/Media/Science"`
	ServiceRequirement string `json:"service_requirement" binding:"omitempty,max=1024" example:"More information about us."`
}

type ClientHistoryDealStatsParams

type ClientHistoryDealStatsParams struct {
	types.PaginationParams
	AddressIdParam
}

type ClientListParam

type ClientListParam struct {
	types.PaginationParams
	repo.ClientOrderParam
	Search string `json:"search" form:"search" binding:"omitempty,lte=255"` // client id/name/location
}

type ClientReviewsParam

type ClientReviewsParam struct {
	types.PaginationParams
	AddressIdParam
}

type EmailVcodeParam

type EmailVcodeParam struct {
	Email string `json:"email" binding:"required,email" example:"test@example.com"`
}

type MetricsOverview

type MetricsOverview struct {
	RegisteredProviders int64           `json:"registered_providers"`
	AutoFilledProviders int64           `json:"auto_filled_providers"`
	RegisteredSpRatio   decimal.Decimal `json:"registered_sp_ratio"`

	InternalContacts     int64           `json:"internal_contacts"`
	AverageAccessesDaily decimal.Decimal `json:"average_accesses_daily"`
	TotalAccesses        int64           `json:"total_accesses"`

	IncrRegisteredProviders int64           `json:"incr_registered_providers"`
	IncrAutoFilledProviders int64           `json:"incr_auto_filled_providers"`
	IncrRegisteredSpRatio   decimal.Decimal `json:"incr_registered_sp_ratio"`

	IncrInternalContacts     int64           `json:"incr_internal_contacts"`
	IncrAverageAccessesDaily decimal.Decimal `json:"incr_average_accesses_daily"`
	IncrTotalAccesses        int64           `json:"incr_total_accesses"`
}

type ModifyPasswordParam

type ModifyPasswordParam struct {
	Password    string `json:"password" binding:"required" example:"Hello123"`
	NewPassword string `json:"new_password" binding:"required,password" example:"Hello456"`
}

type ProfileParam

type ProfileParam struct {
	Name         string `json:"name" binding:"omitempty,max=128" example:"example name"`
	Avatar       string `json:"avatar" binding:"omitempty,max=1024" example:""`
	Location     string `json:"location" binding:"omitempty,max=128" example:"Shanghai,China"`
	ContactEmail string `json:"contact_email" binding:"omitempty,email,max=256" example:"public@example.com"`
	Slack        string `json:"slack" binding:"omitempty,max=128" example:""`
	Github       string `json:"github" binding:"omitempty,max=128" example:""`
	Twitter      string `json:"twitter" binding:"omitempty,max=128" example:""`
	Description  string `json:"description" binding:"omitempty,max=2048" example:"More information about us."`
}

type ProviderDetailParams

type ProviderDetailParams struct {
	Address         string `json:"address" binding:"omitempty,addressid" example:"f01234"`
	AvailableDeals  string `json:"available_deals" binding:"omitempty,max=128" example:"10TiB/D"`
	Bandwidth       string `json:"bandwidth" binding:"omitempty,max=128" example:"300M"`
	SealingSpeed    string `json:"sealing_speed" binding:"omitempty,max=128" example:"10TiB/D"`
	ParallelDeals   string `json:"parallel_deals" binding:"omitempty,max=128" example:"10"`
	RenewableEnergy string `json:"renewable_energy" binding:"omitempty,max=128" example:"1MWh"`
	Certification   string `json:"certification" binding:"omitempty,max=128" example:"PCI Compliance"`
	IsMember        string `json:"is_member" binding:"omitempty,oneof=Yes No" example:"No"`
	Experience      string `json:"experience" binding:"omitempty,max=128" example:"Textile/Estuary"`
}

type ProviderListParam

type ProviderListParam struct {
	types.PaginationParams
	repo.OrderParam
	repo.FilterParam
	Search string `json:"search" form:"search" binding:"omitempty,lte=255"` // miner id/name/location
}

type ResetPwdParams

type ResetPwdParams struct {
	Email       string `json:"email" binding:"required,email" example:"test@example.com"`
	VCode       string `json:"vcode" binding:"required,number,len=6" example:"123456"`
	NewPassword string `json:"new_password" binding:"required,password" example:"Hello456"`
}

type ReviewParams

type ReviewParams struct {
	Provider string `json:"provider" binding:"required,addressid" example:"f01662887"`
	Score    int    `json:"score" binding:"required,min=0,max=5" example:"5"`
	Content  string `json:"content" binding:"required,max=1024" example:"Great. It's the ultimate experience."`
	Title    string `json:"title" binding:"required,max=128" example:"Ultimate Experience"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(conf *settings.AppConfig, dir string, loglevel string, initSystem bool) *Server

func (*Server) Run

func (s *Server) Run(ctx context.Context)

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

func (*Server) Token

func (s *Server) Token(c *gin.Context)

Token godoc @Summary Generate an access token @Tags user @Accept json @Produce json @Param Authorization header string true "jwt refresh token" default(Bearer YOUR_JWT) @Success 200 {object} string "access token" @Router /user/token [post]

type SignUpParam

type SignUpParam struct {
	Type     string `json:"type" binding:"required,oneof=sp_owner data_client" example:"sp_owner"`
	Name     string `json:"name" binding:"required,max=128" example:"hello"`
	Email    string `json:"email" binding:"required,email" example:"test@example.com"`
	Password string `json:"password" binding:"required,password" example:"Hello123"`
	// example privateKey hex: 7b2254797065223a22736563703235366b31222c22507269766174654b6579223a22347179396744327177724f68764148305267667738624b346b52546e575535595337622f4338374435686f3d227d
	Address string `json:"address" binding:"required,address,min=3" example:"f1gxcq2s72oepgufqrkbblbwgnxosrkwn3jib3bmy"`
	// raw data:
	//Signature for filfind
	//f1gxcq2s72oepgufqrkbblbwgnxosrkwn3jib3bmy
	//2022-04-14T12:03:45.169Z
	// raw data hex: 5369676e617475726520666f722066696c66696e640d0a663167786371327337326f657067756671726b62626c6277676e786f73726b776e336a696233626d790d0a323032322d30342d31345431323a30333a34352e3136395a
	Message   string `` /* 236-byte string literal not displayed */
	Signature string `` /* 190-byte string literal not displayed */
}

type UserParam

type UserParam struct {
	Email    string `json:"email" binding:"required,email" example:"test@example.com"`
	Password string `json:"password" binding:"required,password" example:"Hello123"`
}

Jump to

Keyboard shortcuts

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