first commit

This commit is contained in:
Sas Andy
2024-12-09 09:51:19 +07:00
commit ecc5dfd9c0
69 changed files with 5365 additions and 0 deletions

36
types/doctor.types.go Normal file
View File

@@ -0,0 +1,36 @@
package types
type DoctorStore interface {
SearchDoctor(keyword string, page int, perpage int) ([]DoctorResult, error)
}
type Doctor struct {
DoctorID int `json:"DoctorID" db:"DoctorID"`
DoctorCode string `json:"DoctorCode" db:"DoctorCode"`
DoctorIHSNumber string `json:"DoctorIHSNumber" db:"DoctorIHSNumber"`
DoctorPersonID int `json:"DoctorPersonID" db:"DoctorPersonID"`
}
type DoctorJSON struct {
DoctorID int `json:"DoctorID" db:"DoctorID"`
DoctorCode string `json:"DoctorCode" db:"DoctorCode"`
DoctorIHSNumber string `json:"DoctorIHSNumber" db:"DoctorIHSNumber"`
DoctorPersonID int `json:"DoctorPersonID" db:"DoctorPersonID"`
PersonName string `json:"PersonName" db:"PersonName"`
PersonBirthDate string `json:"PersonBirthDate" db:"PersonBirthDate"`
PersonIdentifierValue string `json:"PersonIdentifierValue" db:"PersonIdentifierValue"`
}
type SearchDoctorPayload struct {
Keyword string `json:"keyword"`
Page int `json:"page" validate:"required"`
Perpage int `json:"perpage" validate:"required"`
}
type DoctorResult struct {
Doctor
Person
PersonIdentifier
PersonAddress
PersonTelecom
}

57
types/oauth.types.go Normal file
View File

@@ -0,0 +1,57 @@
package types
import "github.com/markbates/goth"
type OauthStore interface {
AddGoolgeAccount(user UserGoogle) error
CheckGoogleAccountLinked(user UserGoogle) (int, error)
GenerateAuthCode(email string, jenis string, userid int) error
CompareAuthCode(authcode string, user goth.User, typez string) (int, error)
SignInWestone(email string, password string) (*User, error)
LogSignIn(email string, ip string, status string, tipe string, provider string) error
}
type UserGoogle struct {
M_UserGoogleID int `json:"M_UserGoogleID" db:"M_UserGoogleID"`
M_UserGoogleM_UserID int `json:"M_UserGoogleM_UserID" db:"M_UserGoogleM_UserID"`
M_UserGoogleEmail string `json:"M_UserGoogleEmail" db:"M_UserGoogleEmail"`
M_UserGoogleIdentifier string `json:"M_UserGoogleIdentifier" db:"M_UserGoogleIdentifier"`
M_UserGoogleCode string `json:"M_UserGoogleCode" db:"M_UserGoogleCode"`
M_UserGoogleToken string `json:"M_UserGoogleToken" db:"M_UserGoogleToken"`
M_UserGoogleIsActive string `json:"M_UserGoogleIsActive" db:"M_UserGoogleIsActive"`
}
type AuthCode struct {
AuthCodeID int `json:"AuthCodeID" db:"AuthCodeID"`
AuthCodeMUserID int `json:"AuthCodeMUserID" db:"AuthCodeMUserID"`
AuthCodeUser string `json:"AuthCodeUser" db:"AuthCodeUser"`
AuthCodeType string `json:"AuthCodeType" db:"AuthCodeType"`
AuthCodeCode string `json:"AuthCodeCode" db:"AuthCodeCode"`
AuthCodeIsUsed string `json:"AuthCodeIsUsed" db:"AuthCodeIsUsed"`
}
type AuthCodePayload struct {
Code string `json:"code" validate:"required"`
}
type GenerateAuthCode struct {
Email string `json:"email" validate:"required"`
Types string `json:"type" validate:"required"`
UserID int `json:"userid" validate:"required"`
}
type SignInPayload struct {
Email string `json:"email" validate:"required,email"`
Password string `json:"password" validate:"required,min=6,max=130"`
}
type LogLogin struct {
LogLoginMUserEmail string `db:"Log_LoginM_UserEmail" json:"logLoginMUserEmail"`
LogLoginDateTime string `db:"Log_LoginDateTime" json:"logLoginDateTime"`
LogLoginIP string `db:"Log_LoginIP" json:"logLoginIP"`
LogLoginType string `db:"Log_LoginType" json:"logLoginType"`
LogLoginStatus string `db:"Log_LoginStatus" json:"logLoginStatus"`
LogLoginLogin string `db:"Log_LoginLogin" json:"logLoginLogin"`
LogLoginIsActive string `db:"Log_LoginIsActive" json:"logLoginIsActive"`
LogLoginLastUpdated string `db:"Log_LoginLastUpdated" json:"logLoginLastUpdated"`
}

26
types/patient.types.go Normal file
View File

@@ -0,0 +1,26 @@
package types
type PatientStore interface {
SearchPatient(keyword string, page int, perpage int) ([]PatientResult, error)
SearchPatientOld(keyword string, page int, perpage int) ([]PatientResult, error)
}
type Patient struct {
PatientID int `json:"PatientID" db:"PatientID"`
PatientPersonID int `json:"PatientPersonID" db:"PatientPersonID"`
PatientManaginOrganizationID int `json:"PatientManaginOrganizationID" db:"PatientManaginOrganizationID"`
PatientHISNumber string `json:"PatientHISNumber" db:"PatientHISNumber"`
PatientRegNumber string `json:"PatientRegNumber" db:"PatientRegNumber"`
}
type SearchPatientPayload struct {
Keyword string `json:"keyword"`
Page int `json:"page" validate:"required"`
Perpage int `json:"perpage" validate:"required"`
}
type PatientResult struct {
Patient
Person
PersonIdentifier
PersonAddress
PersonTelecom
}

86
types/person.types.go Normal file
View File

@@ -0,0 +1,86 @@
package types
type PersonStore interface {
GetPersonByID(id int) (*Person, error)
}
type Person struct {
PersonID int `json:"PersonID" db:"PersonID"`
PersonName string `json:"PersonName" db:"PersonName"`
PersonSalutation string `json:"PersonSalutation" db:"PersonSalutation"`
PersonPrefix string `json:"PersonPrefix" db:"PersonPrefix"`
PersonSuffix string `json:"PersonSuffix" db:"PersonSuffix"`
PersonGender string `json:"PersonGender" db:"PersonGender"`
PersonBirthPlace string `json:"PersonBirthPlace" db:"PersonBirthPlace"`
PersonBirthDate string `json:"PersonBirthDate" db:"PersonBirthDate"`
PersonReligionCode string `json:"PersonReligionCode" db:"PersonReligionCode"`
PersonReligionSystem string `json:"PersonReligionSystem" db:"PersonReligionSystem"`
PersonBloodTypeCode string `json:"PersonBloodTypeCode" db:"PersonBloodTypeCode"`
PersonBloodTypeSystem string `json:"PersonBloodTypeSystem" db:"PersonBloodTypeSystem"`
PersonRhesusCode string `json:"PersonRhesusCode" db:"PersonRhesusCode"`
PersonRhesusSystem string `json:"PersonRhesusSystem" db:"PersonRhesusSystem"`
PersonEducationCode string `json:"PersonEducationCode" db:"PersonEducationCode"`
PersonEducationSystem string `json:"PersonEducationSystem" db:"PersonEducationSystem"`
PersonJobClassCode string `json:"PersonJobClassCode" db:"PersonJobClassCode"`
PersonJobClassSystem string `json:"PersonJobClassSystem" db:"PersonJobClassSystem"`
PersonEtnicityCode string `json:"PersonEtnicityCode" db:"PersonEtnicityCode"`
PersonEtnicitySystem string `json:"PersonEtnicitySystem" db:"PersonEtnicitySystem"`
PersonMaritalBirth string `json:"PersonMaritalBirth" db:"PersonMaritalBirth"`
PersonMaritalStatus string `json:"PersonMaritalStatus" db:"PersonMaritalStatus"`
}
type PersonJSON struct {
PersonID int `json:"PersonID" db:"PersonID"`
PersonName string `json:"PersonName" db:"PersonName"`
PersonSalutation string `json:"PersonSalutation" db:"PersonSalutation"`
PersonPrefix string `json:"PersonPrefix" db:"PersonPrefix"`
PersonSuffix string `json:"PersonSuffix" db:"PersonSuffix"`
PersonGender string `json:"PersonGender" db:"PersonGender"`
PersonBirthPlace string `json:"PersonBirthPlace" db:"PersonBirthPlace"`
PersonBirthDate string `json:"PersonBirthDate" db:"PersonBirthDate"`
PersonReligion CodeableTerminology `json:"PersonReligion"`
PersonBlood CodeableTerminology `json:"PersonBlood"`
PersonRhesus CodeableTerminology `json:"PersonRhesus"`
PersonEducation CodeableTerminology `json:"PersonEducation"`
PersonJobClass CodeableTerminology `json:"PersonJobClass"`
PersonEtnicity CodeableTerminology `json:"PersonEtnicity"`
PersonMaritalBirth string `json:"PersonMaritalBirth" db:"PersonMaritalBirth"`
PersonMaritalStatus string `json:"PersonMaritalStatus" db:"PersonMaritalStatus"`
}
type PersonIdentifier struct {
PersonIdentifierID int `json:"PersonIdentifierID" db:"PersonIdentifierID"`
PersonIdentifierPersonID int `json:"PersonIdentifierPersonID" db:"PersonIdentifierPersonID"`
PersonIdentifierUse string `json:"PersonIdentifierUse" db:"PersonIdentifierUse"`
PersonIdentifierTypeCode string `json:"PersonIdentifierTypeCode" db:"PersonIdentifierTypeCode"`
PersonIdentifierTypeSystem string `json:"PersonIdentifierTypeSystem" db:"PersonIdentifierTypeSystem"`
PersonIdentifierCode string `json:"PersonIdentifierCode" db:"PersonIdentifierCode"`
PersonIdentifierSystem string `json:"PersonIdentifierSystem" db:"PersonIdentifierSystem"`
PersonIdentifierValue string `json:"PersonIdentifierValue" db:"PersonIdentifierValue"`
}
type PersonAddress struct {
PersonAddressID int `json:"PersonAddressID" db:"PersonAddressID"`
PersonAddressPersonID int `json:"PersonAddressPersonID" db:"PersonAddressPersonID"`
PersonAddressIsDefault string `json:"PersonAddressIsDefault" db:"PersonAddressIsDefault"`
PersonAddressUse string `json:"PersonAddressUse" db:"PersonAddressUse"`
PersonAddressType string `json:"PersonAddressType" db:"PersonAddressType"`
PersonAddressText string `json:"PersonAddressText" db:"PersonAddressText"`
PersonAddressLine1 string `json:"PersonAddressLine1" db:"PersonAddressLine1"`
PersonAddressLine2 string `json:"PersonAddressLine2" db:"PersonAddressLine2"`
PersonAddressRegionalCd string `json:"PersonAddressRegionalCd" db:"PersonAddressRegionalCd"`
PersonAddressRT string `json:"PersonAddressRT" db:"PersonAddressRT"`
PersonAddressRW string `json:"PersonAddressRW" db:"PersonAddressRW"`
PersonAddressCity string `json:"PersonAddressCity" db:"PersonAddressCity"`
PersonAddressDistrict string `json:"PersonAddressDistrict" db:"PersonAddressDistrict"`
PersonAddressState string `json:"PersonAddressState" db:"PersonAddressState"`
PersonAddressCountry string `json:"PersonAddressCountry" db:"PersonAddressCountry"`
}
type PersonTelecom struct {
PersonTelecomID int `json:"PersonTelecomID" db:"PersonTelecomID"`
PersonTelecomPersonID int `json:"PersonTelecomPersonID" db:"PersonTelecomPersonID"`
PersonTelecomSystem string `json:"PersonTelecomSystem" db:"PersonTelecomSystem"`
PersonTelecomValue string `json:"PersonTelecomValue" db:"PersonTelecomValue"`
PersonTelecomUse string `json:"PersonTelecomUse" db:"PersonTelecomUse"`
}

View File

@@ -0,0 +1,16 @@
package types
type TerminologyStore interface {
GetTerminologyDisplay(code string, system string) (*CodeableTerminology, error)
}
type CodeableTerminology struct {
CodeSystem string `json:"CodeSystem" db:"code_system"`
Code string `json:"Code" db:"code"`
Display string `json:"Display" db:"display"`
}
type GetTerminologyDisplayPayload struct {
Code string `json:"code" validate:"required"`
CodeSystem string `json:"codesystem" validate:"required"`
}

74
types/types.go Normal file
View File

@@ -0,0 +1,74 @@
package types
import (
"time"
"sismedika.com/sas/westone/utils"
)
type Product struct {
ID int `db:"id" json:"id"`
Name string `db:"name" json:"name"`
Description string `db:"description" json:"description"`
Image string `db:"image" json:"image"`
Price float64 `db:"price" json:"price"`
Quantity int `db:"quantity" json:"quantity"`
CreatedAt time.Time `db:"createdAt" json:"createdAt"`
}
type CartCheckoutItem struct {
ProductID int `db:"productID" json:"productID"`
Quantity int `db:"quantity" json:"quantity"`
}
type Order struct {
ID int `db:"id" json:"id"`
UserID int `db:"userID" json:"userID"`
Total float64 `db:"total" json:"total"`
Status string `db:"status" json:"status"`
Address string `db:"address" json:"address"`
CreatedAt time.Time `db:"createdAt" json:"createdAt"`
}
type OrderItem struct {
ID int `db:"id" json:"id"`
OrderID int `db:"orderID" json:"orderID"`
ProductID int `db:"productID" json:"productID"`
Quantity int `db:"quantity" json:"quantity"`
Price float64 `db:"price" json:"price"`
CreatedAt time.Time `db:"createdAt" json:"createdAt"`
}
type ProductStore interface {
GetProductByID(id int) (*Product, error)
GetProductsByID(ids []int) ([]Product, error)
GetProducts() ([]*Product, error)
CreateProduct(CreateProductPayload) error
UpdateProduct(Product) error
}
type OrderStore interface {
CreateOrder(Order) (int, error)
CreateOrderItem(OrderItem) error
}
type CreateProductPayload struct {
Name string `json:"name" validate:"required"`
Description string `json:"description"`
Image string `json:"image"`
Price float64 `json:"price" validate:"required"`
Quantity int `json:"quantity" validate:"required"`
}
type CartCheckoutPayload struct {
Items []CartCheckoutItem `json:"items" validate:"required"`
}
type ErrorLogStore interface {
CreateErrorLog(utils.LogError) error
}
type DataJWT struct {
User
Ip string `json:"ip"`
Agent string `json:"agent"`
Version string `json:"version"`
LastLogin string `json:"last-login"`
}

33
types/user.types.go Normal file
View File

@@ -0,0 +1,33 @@
package types
// type User struct {
// ID int `db:"id" json:"id"`
// FirstName string `db:"firstName" json:"firstName"`
// LastName string `db:"lastName" json:"lastName"`
// Email string `db:"email" json:"email"`
// Password string `db:"password" json:"-"`
// CreatedAt time.Time `db:"createdAt" json:"createdAt"`
// }
type UserStore interface {
GetUserByID(id int) (*User, error)
CreateUser(User) error
}
type RegisterUserPayload struct {
FirstName string `json:"firstName" validate:"required"`
LastName string `json:"lastName" validate:"required"`
Email string `json:"email" validate:"required,email"`
Password string `json:"password" validate:"required,min=8,max=130"`
}
type User struct {
M_UserID int `json:"M_UserID" db:"M_UserID"`
M_UserEmail string `json:"M_UserEmail" db:"M_UserEmail"`
M_UserUsername string `json:"M_UserUsername" db:"M_UserUsername"`
M_UserGroupDashboard string `json:"M_UserGroupDashboard" db:"M_UserGroupDashboard"`
M_UserDefaultTSampleStationID string `json:"M_UserDefaultT_SampleStationID" db:"M_UserDefaultT_SampleStationID"`
M_StaffName string `json:"M_StaffName" db:"M_StaffName"`
Is_Courier string `json:"is_courier" db:"is_courier"`
Time_Autologout string `json:"time_autologout" db:"time_autologout"`
Type_Akun string `json:"Type_Akun"`
}