perubahan
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
package mongo
|
||||
|
||||
import (
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
)
|
||||
|
||||
type DatabaseService struct {
|
||||
DB *mongo.Database
|
||||
}
|
||||
|
||||
func NewDatabaseService(db *mongo.Database) *DatabaseService {
|
||||
return &DatabaseService{DB: db}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package mongo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"template_blueprint/pkg/models/master_data"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (s *DatabaseService) InsertDataMaster(req master_data.ReqInsertData) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
_, err := s.DB.Collection(req.Table).InsertOne(ctx, master_data.ReqInsertDataMaster{
|
||||
ID: req.ID,
|
||||
System: req.System,
|
||||
Code: req.Code,
|
||||
Display: req.Display,
|
||||
})
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package mongo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"log"
|
||||
"template_blueprint/pkg/models/local"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (s *DatabaseService) GetDataLog() ([]*local.StartUpLog, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
dataLog, err := s.DB.Collection("startup_log").Find(ctx, bson.M{})
|
||||
if err != nil {
|
||||
log.Println("MASUK SINI")
|
||||
log.Println(err)
|
||||
return nil, err
|
||||
}
|
||||
log.Println("Data", dataLog.Current)
|
||||
var logs []*local.StartUpLog
|
||||
errDecode := dataLog.All(ctx, &logs)
|
||||
if errDecode != nil {
|
||||
log.Println(errDecode)
|
||||
return nil, errDecode
|
||||
}
|
||||
log.Println("LOGS :", logs)
|
||||
return logs, nil
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package mongo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"log"
|
||||
"template_blueprint/pkg/models/patient"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (s *DatabaseService) InsertPatient(req *patient.Patient) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
_, err := s.DB.Collection("patient").InsertOne(ctx, req)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *DatabaseService) GetAllDataPatient() ([]*patient.Patient, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
dataUser, err := s.DB.Collection("patient").Find(ctx, bson.D{})
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
var users []*patient.Patient
|
||||
err = dataUser.All(ctx, &users)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return nil, err
|
||||
}
|
||||
return users, nil
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package mongo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"log"
|
||||
"template_blueprint/pkg/models/user"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (s *DatabaseService) InsertUser(req user.ReqInsertUser) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
_, err := s.DB.Collection("user").InsertOne(ctx, user.ReqInsertUser{
|
||||
ID: req.ID,
|
||||
Name: req.Name,
|
||||
Age: req.Age,
|
||||
Address: req.Address,
|
||||
Gender: req.Gender,
|
||||
Religion: req.Religion,
|
||||
})
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *DatabaseService) GetAllDataUser() ([]*user.User, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
dataUser, err := s.DB.Collection("user").Find(ctx, bson.D{})
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
var users []*user.User
|
||||
err = dataUser.All(ctx, &users)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return nil, err
|
||||
}
|
||||
return users, nil
|
||||
}
|
||||
|
||||
func (s *DatabaseService) GetUserById(id string) (*user.User, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
dataUser := s.DB.Collection("user").FindOne(ctx, bson.D{{Key: "_id", Value: id}})
|
||||
var user *user.User
|
||||
err := dataUser.Decode(&user)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return nil, err
|
||||
}
|
||||
return user, nil
|
||||
}
|
||||
|
||||
func (s *DatabaseService) UpdateUser(reqUpdate *user.ReqUpdateUser) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
log.Println(reqUpdate.ID)
|
||||
filter := bson.M{"_id": reqUpdate.ID}
|
||||
update := bson.M{"$set": bson.M{
|
||||
"name": reqUpdate.Name,
|
||||
"age": reqUpdate.Age,
|
||||
"address": reqUpdate.Address,
|
||||
"gender": reqUpdate.Gender,
|
||||
"religion": reqUpdate.Religion,
|
||||
}}
|
||||
updatedData, err := s.DB.Collection("user").UpdateOne(ctx, filter, update)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return err
|
||||
}
|
||||
log.Println(updatedData)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *DatabaseService) DeleteUserById(id string) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
_, err := s.DB.Collection("user").DeleteOne(ctx, bson.D{{Key: "_id", Value: id}})
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package satu_data
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"log"
|
||||
"template_blueprint/pkg/models/satu_data"
|
||||
)
|
||||
|
||||
func (s *DatabaseService) PoliklinikGetData(Status_pelayanan string) []*satu_data.PoliklinikGetData {
|
||||
var datapoliklinik []*satu_data.PoliklinikGetData
|
||||
query := `select dlr."Nama",dlr."Kode",dlr."id" from daftar_lokasi_ruang dlr where dlr."Status_pelayanan" = ?`
|
||||
errQuery := s.DB.Debug().Raw(query, Status_pelayanan).Scan(&datapoliklinik).Error
|
||||
if errQuery != nil {
|
||||
if errors.Is(errQuery, gorm.ErrRecordNotFound) {
|
||||
errMsg := errors.New("Data Tidak Ditemukan")
|
||||
log.Println(errMsg)
|
||||
return nil
|
||||
}
|
||||
log.Println(errQuery)
|
||||
return nil
|
||||
}
|
||||
return datapoliklinik
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package satu_data
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"template_blueprint/pkg/models/satu_data"
|
||||
)
|
||||
|
||||
func (s *DatabaseService) GetRetribusi(Limit string, Offset string) ([]*satu_data.Retribusi, error) {
|
||||
var result []*satu_data.Retribusi
|
||||
query := `select * from data_retribusi dr limit ? offset ?`
|
||||
errQuery := s.DB.Debug().Raw(query, Limit, Offset).Scan(&result).Error
|
||||
if errQuery != nil {
|
||||
log.Println("errQuery:", errQuery)
|
||||
return nil, errQuery
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (s *DatabaseService) InsertRetribusi(data *satu_data.Retribusi) error {
|
||||
//id := uuid.New()
|
||||
log.Println("ini data:", data)
|
||||
//data.ID = id.String()
|
||||
|
||||
//log.Println("InsertRetribusi:", data)
|
||||
query := `insert into data_retribusi ("id", "status", "sort", "user_created", "date_created", "Jenis", "Pelayanan", "Dinas",
|
||||
"Kelompok_obyek", "Kode_tarif", "Tarif", "Satuan", "Tarif_overtime", "Satuan_overtime",
|
||||
"Rekening_pokok", "Rekening_denda","Uraian_1", "Uraian_2", "Uraian_3")
|
||||
values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`
|
||||
errQuery := s.DB.Debug().Exec(query, data.ID, data.Status, data.Sort, data.UserCreated, data.DateCreated,
|
||||
data.Jenis, data.Pelayanan, data.Dinas, data.KelompokObyek,
|
||||
data.KodeTarif, data.Tarif, data.Satuan, data.TarifOverTime, data.SatuanOverTime, data.RekeningPokok, data.RekeningDenda,
|
||||
data.Uraian1, data.Uraian2, data.Uraian3).Error
|
||||
if errQuery != nil {
|
||||
log.Println(errQuery)
|
||||
return errors.New("Tidak dapat Simpan data retribusi")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *DatabaseService) UpdateRetribusi(data *satu_data.Retribusi) error {
|
||||
log.Println("update data_retribusi:", data)
|
||||
query := `update data_retribusi set status=?, sort=?, user_updated=?, date_updated=?, "Jenis"=?, "Pelayanan"=?, "Dinas"=?, "Kelompok_obyek"=?, "Kode_tarif"=?, "Tarif"=?, "Satuan"=?, "Tarif_overtime"=?, "Satuan_overtime"=?, "Rekening_pokok"=?, "Rekening_denda"=?, "Uraian_1"=?, "Uraian_2"=?, "Uraian_3"=? where id=?`
|
||||
errQuery := s.DB.Debug().Exec(query, data.Status, data.Sort, data.UserUpdated, data.DateUpdated, data.Jenis, data.Pelayanan, data.Dinas, data.KelompokObyek, data.KodeTarif, data.Tarif, data.Satuan, data.TarifOverTime, data.SatuanOverTime, data.RekeningPokok, data.RekeningDenda, data.Uraian1, data.Uraian2, data.Uraian3, data.ID).Error
|
||||
if errQuery != nil {
|
||||
log.Println(errQuery)
|
||||
return errors.New("Tidak dapat ubah data retribusi")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *DatabaseService) DeleteRetribusi(id string) error {
|
||||
query := `delete from data_retribusi where id=?`
|
||||
errQuery := s.DB.Debug().Exec(query, id).Error
|
||||
if errQuery != nil {
|
||||
log.Println(errQuery)
|
||||
return errors.New("Tidak dapat hapus data retribusi")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *DatabaseService) SearchRetribusi(kelompok_obyek string) ([]*satu_data.Retribusi, error) {
|
||||
//log.Println("search retribusi by:", kelompok_obyek)
|
||||
var result []*satu_data.Retribusi
|
||||
query := `select * from data_retribusi where "Kelompok_obyek"=?`
|
||||
errQuery := s.DB.Debug().Raw(query, kelompok_obyek).Scan(&result).Error
|
||||
if errQuery != nil {
|
||||
log.Println(errQuery)
|
||||
return nil, errors.New("Tidak dapat data retribusi")
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package master_data
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
"net/http"
|
||||
"os"
|
||||
"template_blueprint/internal/database"
|
||||
"template_blueprint/pkg/database/mongo"
|
||||
"template_blueprint/pkg/models/master_data"
|
||||
)
|
||||
|
||||
func InsertDataMaster(c *gin.Context) {
|
||||
master := os.Getenv("BLUEPRINT_DB_MASTER")
|
||||
var ReqInsertData master_data.ReqInsertData
|
||||
errBind := c.Bind(&ReqInsertData)
|
||||
if errBind != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"code": 400,
|
||||
})
|
||||
}
|
||||
db := database.New(master).GetMongoDB()
|
||||
mongoDB := mongo.NewDatabaseService(db)
|
||||
ReqInsertData.ID = uuid.New().String()
|
||||
errInsert := mongoDB.InsertDataMaster(ReqInsertData)
|
||||
if errInsert != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"message": "Failed Insert User",
|
||||
})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"message": "Successfully Inserted User"})
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package mongo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"template_blueprint/internal/database"
|
||||
"template_blueprint/pkg/database/mongo"
|
||||
"template_blueprint/pkg/models/local"
|
||||
"time"
|
||||
)
|
||||
|
||||
func GetDataLog(c *gin.Context) {
|
||||
locals := os.Getenv("BLUEPRINT_DB_LOCAL")
|
||||
db := database.New(locals).GetMongoDB()
|
||||
if db == nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": "Database connection failed"})
|
||||
return
|
||||
}
|
||||
mongoDB := mongo.NewDatabaseService(db)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
|
||||
cursor, err := mongoDB.DB.Collection("startup_log").Find(ctx, bson.M{})
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": "Database query failed"})
|
||||
return
|
||||
}
|
||||
|
||||
var dataLog []*local.StartUpLog
|
||||
errDecode := cursor.All(ctx, &dataLog)
|
||||
if errDecode != nil {
|
||||
log.Println(errDecode)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": "Database query failed"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, dataLog)
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package patient
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"os"
|
||||
"template_blueprint/internal/database"
|
||||
"template_blueprint/pkg/database/mongo"
|
||||
"template_blueprint/pkg/models/patient"
|
||||
"time"
|
||||
)
|
||||
|
||||
func InsertPatient(c *gin.Context) {
|
||||
local := os.Getenv("MONGODB_DEV_LOCAL")
|
||||
db := database.New(local).GetMongoDB()
|
||||
if db == nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": "Database connection failed"})
|
||||
return
|
||||
}
|
||||
mongoDB := mongo.NewDatabaseService(db)
|
||||
var req *patient.Patient
|
||||
err := c.Bind(&req)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
dateCreated := time.Now().Format("2006-01-02 15:04:05")
|
||||
req.ResourceType = "Patient"
|
||||
req.CreatedAt = dateCreated
|
||||
|
||||
errInsert := mongoDB.InsertPatient(req)
|
||||
if errInsert != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": errInsert.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"message": "Patient successfully inserted"})
|
||||
}
|
||||
|
||||
func GetAllPatient(c *gin.Context) {
|
||||
local := os.Getenv("MONGODB_DEV_LOCAL")
|
||||
db := database.New(local).GetMongoDB()
|
||||
if db == nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": "Database connection failed"})
|
||||
return
|
||||
}
|
||||
mongoDB := mongo.NewDatabaseService(db)
|
||||
dataPatient, errSelect := mongoDB.GetAllDataPatient()
|
||||
if errSelect != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": errSelect.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, dataPatient)
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package poliklinik
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"log"
|
||||
"net/http"
|
||||
"template_blueprint/internal/database"
|
||||
connDatabase "template_blueprint/pkg/database/satu_data"
|
||||
)
|
||||
|
||||
func GetDataPoliklinik(c *gin.Context) {
|
||||
db := database.New().GetDB("satudata")
|
||||
satudata := connDatabase.NewDatabaseService(db)
|
||||
statuspelayanan := c.Param("statuspelayanan")
|
||||
|
||||
log.Println("REQUEST", statuspelayanan)
|
||||
dataPoliklinik := satudata.PoliklinikGetData(statuspelayanan)
|
||||
|
||||
c.JSON(http.StatusOK, dataPoliklinik)
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
package retribusi
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
"log"
|
||||
"net/http"
|
||||
"template_blueprint/internal/database"
|
||||
//_ "template_blueprint/cmd/api/docs"
|
||||
//_ "template_blueprint/docs"
|
||||
//_ "template_blueprint/docs"
|
||||
//_ "template_blueprint/internal/docs"
|
||||
connDatabase "template_blueprint/pkg/database/satu_data"
|
||||
"template_blueprint/pkg/models/satu_data"
|
||||
"time"
|
||||
)
|
||||
|
||||
// GetDataRetribusi return list of all retribution from the database
|
||||
// @Summary all retribution
|
||||
// @Description return list of all retribution from the database
|
||||
// @Param limit path string true "limit"
|
||||
// @Param offset path string true "offset"
|
||||
// @Tags Retribusi
|
||||
// @Success 200 {object} satu_data.Retribusi
|
||||
// @Router /retribusi/getData/Limit/{limit}/Offset/{offset} [get]
|
||||
func GetDataRetribusi(c *gin.Context) {
|
||||
db := database.New().GetDB("satudata")
|
||||
satudata := connDatabase.NewDatabaseService(db)
|
||||
limit := c.Param("limit")
|
||||
offset := c.Param("offset")
|
||||
|
||||
log.Println("limit:", limit, ",offset:", offset)
|
||||
dataRetribusi, err := satudata.GetRetribusi(limit, offset)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"message": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
if len(dataRetribusi) == 0 {
|
||||
//log.Println("data retribusi tidak ditemukan")
|
||||
c.JSON(http.StatusNotFound, gin.H{"message": "data retribusi tidak ditemukan"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, dataRetribusi)
|
||||
}
|
||||
|
||||
// InsertRetribution godoc
|
||||
// @Summary Create retribution
|
||||
// @Description Save retribution data in DB
|
||||
// @Param data body satu_data.Retribusi true "data Retribusi"
|
||||
// @Produce application/json
|
||||
// @Tags Retribusi
|
||||
// @Success 200 {object} map[string]string "Data Berhasil disimpan"
|
||||
// @Router /retribusi/insertretribusi [post]
|
||||
func InsertRetribution(c *gin.Context) {
|
||||
db := database.New().GetDB("satudata")
|
||||
satudata := connDatabase.NewDatabaseService(db)
|
||||
|
||||
var request *satu_data.Retribusi
|
||||
err := c.Bind(&request)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
ID := uuid.New().String()
|
||||
timeNow := time.Now().Format("2006-01-02 15:04:05")
|
||||
reqInsert := &satu_data.Retribusi{
|
||||
ID: ID,
|
||||
Status: request.Status,
|
||||
Sort: request.Sort,
|
||||
UserCreated: request.UserCreated,
|
||||
DateCreated: timeNow,
|
||||
Jenis: request.Jenis,
|
||||
Pelayanan: request.Pelayanan,
|
||||
Dinas: request.Dinas,
|
||||
KelompokObyek: request.KelompokObyek,
|
||||
KodeTarif: request.KodeTarif,
|
||||
Tarif: request.Tarif,
|
||||
Satuan: request.Satuan,
|
||||
TarifOverTime: request.TarifOverTime,
|
||||
SatuanOverTime: request.SatuanOverTime,
|
||||
RekeningPokok: request.RekeningPokok,
|
||||
RekeningDenda: request.RekeningDenda,
|
||||
Uraian1: request.Uraian1,
|
||||
Uraian2: request.Uraian2,
|
||||
Uraian3: request.Uraian3,
|
||||
}
|
||||
|
||||
//log.Println("request:", request)
|
||||
//fmt.Println(reflect.TypeOf(reqInsert))
|
||||
errInsertData := satudata.InsertRetribusi(reqInsert)
|
||||
if errInsertData != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": errInsertData.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusCreated, gin.H{"message": "Data Berhasil disimpan"})
|
||||
}
|
||||
|
||||
// UpdateRetribution godoc
|
||||
// @Summary Update retribution
|
||||
// @Description Change retribution data in DB
|
||||
// @Param data body satu_data.Retribusi true "data Retribusi"
|
||||
// @Produce application/json
|
||||
// @Tags Retribusi
|
||||
// @Success 200 {object} map[string]string "Data Berhasil Diubah"
|
||||
// @Router /retribusi/updateretribusi [put]
|
||||
func UpdateRetribution(c *gin.Context) {
|
||||
db := database.New().GetDB("satudata")
|
||||
satudata := connDatabase.NewDatabaseService(db)
|
||||
|
||||
var request *satu_data.Retribusi
|
||||
err := c.Bind(&request)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
timeNow := time.Now().Format("2006-01-02 15:04:05")
|
||||
reqUpdate := &satu_data.Retribusi{
|
||||
ID: request.ID,
|
||||
Status: request.Status,
|
||||
Sort: request.Sort,
|
||||
UserUpdated: request.UserUpdated,
|
||||
DateUpdated: timeNow,
|
||||
Jenis: request.Jenis,
|
||||
Pelayanan: request.Pelayanan,
|
||||
Dinas: request.Dinas,
|
||||
KelompokObyek: request.KelompokObyek,
|
||||
KodeTarif: request.KodeTarif,
|
||||
Tarif: request.Tarif,
|
||||
Satuan: request.Satuan,
|
||||
TarifOverTime: request.TarifOverTime,
|
||||
SatuanOverTime: request.SatuanOverTime,
|
||||
RekeningPokok: request.RekeningPokok,
|
||||
RekeningDenda: request.RekeningDenda,
|
||||
Uraian1: request.Uraian1,
|
||||
Uraian2: request.Uraian2,
|
||||
Uraian3: request.Uraian3,
|
||||
}
|
||||
errUpdateData := satudata.UpdateRetribusi(reqUpdate)
|
||||
if errUpdateData != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": errUpdateData.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"message": "Data Berhasil Diubah", "data": reqUpdate})
|
||||
}
|
||||
|
||||
// DeleteDataRetribusi godoc
|
||||
// @Summary Delete retribution
|
||||
// @Description Remove retribution data by id
|
||||
// @Param ID path string true "ID"
|
||||
// @Produce application/json
|
||||
// @Tags Retribusi
|
||||
// @Success 200 {object} map[string]string "Data Berhasil dihapus"
|
||||
// @Router /retribusi/deleteretribusi/{ID} [delete]
|
||||
func DeleteDataRetribusi(c *gin.Context) {
|
||||
db := database.New().GetDB("satudata")
|
||||
satudata := connDatabase.NewDatabaseService(db)
|
||||
|
||||
//var request *satu_data.Retribusi
|
||||
ID := c.Param("id")
|
||||
//err := c.Bind(&request)
|
||||
//if err != nil {
|
||||
// c.JSON(http.StatusInternalServerError, gin.H{"message": err.Error})
|
||||
// return
|
||||
//}
|
||||
|
||||
errDelete := satudata.DeleteRetribusi(ID)
|
||||
if errDelete != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": error.Error})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"message": "Data Berhasil dihapus"})
|
||||
}
|
||||
|
||||
// SearchDataRetribusi godoc
|
||||
// @Summary Search retribution
|
||||
// @Description search retribution data by id
|
||||
// @Param Kelompok_obyek path string true "Kelompok_obyek"
|
||||
// @Produce application/json
|
||||
// @Tags Retribusi
|
||||
// @Success 200 {object} satu_data.Retribusi
|
||||
// @Router /retribusi/searchData/{kelompok_obyek} [get]
|
||||
func SearchDataRetribusi(c *gin.Context) {
|
||||
db := database.New().GetDB("satudata")
|
||||
satudata := connDatabase.NewDatabaseService(db)
|
||||
|
||||
Kelompok_obyek := c.Param("kelompok_obyek")
|
||||
|
||||
//log.Println("Kelompok_obyek :", Kelompok_obyek)
|
||||
dataRetribusi, err := satudata.SearchRetribusi(Kelompok_obyek)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
if len(dataRetribusi) == 0 {
|
||||
//log.Println("data retribusi tidak ditemukan")
|
||||
c.JSON(http.StatusNotFound, gin.H{"message": "data retribusi tidak ditemukan"})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, dataRetribusi)
|
||||
}
|
||||
@@ -1,168 +0,0 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"template_blueprint/internal/database"
|
||||
"template_blueprint/pkg/database/mongo"
|
||||
"template_blueprint/pkg/models/user"
|
||||
)
|
||||
|
||||
// InsertUser godoc
|
||||
// @Summary Insert a new user
|
||||
// @Description Adds a new user to the database
|
||||
// @Tags users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param request body user.ReqInsertUser true "User Data"
|
||||
// @Success 200 {object} map[string]string "Successfully Inserted User"
|
||||
// @Failure 400 {object} map[string]string "Bad Request"
|
||||
// @Failure 500 {object} map[string]string "Database connection failed"
|
||||
// @Router /api/localinsertuser [post]
|
||||
func InsertUser(c *gin.Context) {
|
||||
local := os.Getenv("MONGODB_DEV_LOCAL")
|
||||
db := database.New(local).GetMongoDB()
|
||||
if db == nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": "Database connection failed"})
|
||||
return
|
||||
}
|
||||
mongoDB := mongo.NewDatabaseService(db)
|
||||
var reqInsert user.ReqInsertUser
|
||||
|
||||
errBind := c.Bind(&reqInsert)
|
||||
if errBind != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"message": errBind.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
id := uuid.New().String()
|
||||
reqInsert.ID = id
|
||||
errInsert := mongoDB.InsertUser(reqInsert)
|
||||
if errInsert != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"message": errInsert.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"message": "Successfully Inserted User"})
|
||||
}
|
||||
|
||||
// GetAllUser godoc
|
||||
// @Summary Get all users
|
||||
// @Description Retrieves all users from the database
|
||||
// @Tags users
|
||||
// @Produce json
|
||||
// @Success 200 {array} user.User "List of users"
|
||||
// @Failure 500 {object} map[string]string "Database connection failed"
|
||||
// @Router /api/local/getalluser [get]
|
||||
func GetAllUser(c *gin.Context) {
|
||||
local := os.Getenv("MONGODB_DEV_LOCAL")
|
||||
db := database.New(local).GetMongoDB()
|
||||
if db == nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": "Database connection failed"})
|
||||
return
|
||||
}
|
||||
mongoDB := mongo.NewDatabaseService(db)
|
||||
dataUser, errSelect := mongoDB.GetAllDataUser()
|
||||
if errSelect != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"message": errSelect.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, dataUser)
|
||||
}
|
||||
|
||||
// GetUserByID godoc
|
||||
// @Summary Get user by ID
|
||||
// @Description Retrieves a user by their ID
|
||||
// @Tags users
|
||||
// @Produce json
|
||||
// @Param id path string true "User ID"
|
||||
// @Success 200 {object} user.User "User data"
|
||||
// @Failure 400 {object} map[string]string "Bad Request"
|
||||
// @Router /api/local/getuser/{id} [get]
|
||||
func GetUserByID(c *gin.Context) {
|
||||
local := os.Getenv("BLUEPRINT_DB_LOCAL")
|
||||
db := database.New(local).GetMongoDB()
|
||||
if db == nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": "Database connection failed"})
|
||||
return
|
||||
}
|
||||
id := c.Param("id")
|
||||
log.Println("ID", id)
|
||||
mongoDB := mongo.NewDatabaseService(db)
|
||||
dataUser, errSelect := mongoDB.GetUserById(id)
|
||||
if errSelect != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"message": errSelect.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, dataUser)
|
||||
}
|
||||
|
||||
// UpdateUser godoc
|
||||
// @Summary Update a user
|
||||
// @Description Updates user information
|
||||
// @Tags users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param request body user.User true "User Data"
|
||||
// @Success 200 {object} map[string]string "Successfully Updated User"
|
||||
// @Failure 400 {object} map[string]string "Bad Request"
|
||||
// @Failure 500 {object} map[string]string "Database connection failed"
|
||||
// @Router /users [put]
|
||||
func UpdateUser(c *gin.Context) {
|
||||
local := os.Getenv("BLUEPRINT_DB_LOCAL")
|
||||
db := database.New(local).GetMongoDB()
|
||||
if db == nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": "Database connection failed"})
|
||||
return
|
||||
}
|
||||
mongoDB := mongo.NewDatabaseService(db)
|
||||
var reqUpdate *user.ReqUpdateUser
|
||||
errBind := c.Bind(&reqUpdate)
|
||||
if errBind != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"message": errBind.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
log.Println("REQ UPDATE", reqUpdate)
|
||||
errUpdate := mongoDB.UpdateUser(reqUpdate)
|
||||
if errUpdate != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"message": errUpdate.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"message": "Successfully Updated User"})
|
||||
}
|
||||
|
||||
func DeleteUser(c *gin.Context) {
|
||||
local := os.Getenv("BLUEPRINT_DB_LOCAL")
|
||||
db := database.New(local).GetMongoDB()
|
||||
if db == nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": "Database connection failed"})
|
||||
return
|
||||
}
|
||||
mongoDB := mongo.NewDatabaseService(db)
|
||||
var reqDelete *user.ReqDeleteUser
|
||||
errBind := c.Bind(&reqDelete)
|
||||
if errBind != nil {
|
||||
c.JSON(400, gin.H{})
|
||||
return
|
||||
}
|
||||
log.Println("REQ DELETE", reqDelete)
|
||||
errDelete := mongoDB.DeleteUserById(reqDelete.ID)
|
||||
if errDelete != nil {
|
||||
c.JSON(400, gin.H{"message": "Failed to Delete User"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"message": "Successfully Deleted User"})
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
package encounter
|
||||
@@ -1,72 +0,0 @@
|
||||
package local
|
||||
|
||||
type StartUpLog struct {
|
||||
ID string `bson:"_id"`
|
||||
HostName string `bson:"hostname"`
|
||||
StartTime string `bson:"start_time"`
|
||||
StartTimeLocal string `bson:"start_time_local"`
|
||||
CmdLine CmdLine `bson:"cmdline"`
|
||||
Pid int `bson:"pid"`
|
||||
BuildInfo BuildInfo `bson:"buildinfo"`
|
||||
}
|
||||
|
||||
type CmdLine struct {
|
||||
Net Net `bson:"net"`
|
||||
ProcessManagement ProcessManagement `bson:"processManagement"`
|
||||
SystemLog SystemLog `bson:"systemLog"`
|
||||
}
|
||||
|
||||
type Net struct {
|
||||
BindIP string `bson:"bindIp"`
|
||||
Port int `bson:"port"`
|
||||
Tls TLS `bson:"tls"`
|
||||
}
|
||||
|
||||
type TLS struct {
|
||||
Mode string `bson:"mode"`
|
||||
}
|
||||
|
||||
type ProcessManagement struct {
|
||||
Fork bool `bson:"fork"`
|
||||
PidFilePath string `bson:"pidFilePath"`
|
||||
}
|
||||
|
||||
type SystemLog struct {
|
||||
Destination string `bson:"destination"`
|
||||
LogAppend bool `bson:"logAppend"`
|
||||
Path string `bson:"path"`
|
||||
}
|
||||
|
||||
type BuildInfo struct {
|
||||
Version string `bson:"version"`
|
||||
GitVersion string `bson:"gitVersion"`
|
||||
Modules []string `bson:"modules"`
|
||||
Allocator string `bson:"allocator"`
|
||||
JavaScriptEngine string `bson:"javaScriptEngine"`
|
||||
SysInfo string `bson:"sysInfo"`
|
||||
VersionArray []int `bson:"versionArray"`
|
||||
OpenSSL OpenSSL `bson:"openssl"`
|
||||
BuildEnvironment BuildEnvironment `bson:"buildEnvironment"`
|
||||
Bits int `bson:"bits"`
|
||||
Debug bool `bson:"debug"`
|
||||
MaxBsonObjectSize int `bson:"maxBsonObjectSize"`
|
||||
StorageEngines []string `bson:"storageEngines"`
|
||||
}
|
||||
|
||||
type OpenSSL struct {
|
||||
Running string `bson:"running"`
|
||||
Compiled string `bson:"compiled"`
|
||||
}
|
||||
|
||||
type BuildEnvironment struct {
|
||||
DistMod string `bson:"distmod"`
|
||||
Distarch string `bson:"distarch"`
|
||||
CC string `bson:"cc"`
|
||||
CCFlags string `bson:"ccflags"`
|
||||
CXX string `bson:"cxx"`
|
||||
CXXFlags string `bson:"cxxflags"`
|
||||
LinkFlags string `bson:"linkflags"`
|
||||
TargetArch string `bson:"target_arch"`
|
||||
TargetOS string `bson:"target_os"`
|
||||
CPPDefines string `bson:"cppdefines"`
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package master_data
|
||||
|
||||
type ReqInsertData struct {
|
||||
ID string `bson:"_id"`
|
||||
Table string `bson:"table"`
|
||||
System string `bson:"system"`
|
||||
Code string `bson:"code"`
|
||||
Display string `bson:"display"`
|
||||
}
|
||||
|
||||
type ReqInsertDataMaster struct {
|
||||
ID string `bson:"_id"`
|
||||
System string `bson:"system"`
|
||||
Code string `bson:"code"`
|
||||
Display string `bson:"display"`
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
package patient
|
||||
|
||||
type Coding struct {
|
||||
System string `bson:"system,omitempty"`
|
||||
Version string `bson:"version,omitempty"`
|
||||
Code string `bson:"code,omitempty"`
|
||||
Display string `bson:"display,omitempty"`
|
||||
UserSelected bool `bson:"userSelected,omitempty"`
|
||||
}
|
||||
|
||||
type Identifier struct {
|
||||
Use string `bson:"use,omitempty"`
|
||||
Type CodeableConcept `bson:"type,omitempty"`
|
||||
System string `bson:"system,omitempty"`
|
||||
Value string `bson:"value,omitempty"`
|
||||
Period Period `bson:"period,omitempty"`
|
||||
Assigner struct{} `bson:"assigner,omitempty"`
|
||||
}
|
||||
|
||||
type CodeableConcept struct {
|
||||
Coding []Coding `bson:"coding,omitempty"`
|
||||
Text string `bson:"text,omitempty"`
|
||||
}
|
||||
|
||||
type Period struct {
|
||||
Start string `bson:"start,omitempty"`
|
||||
End string `bson:"end,omitempty"`
|
||||
}
|
||||
|
||||
type ContactPoint struct {
|
||||
System string `bson:"system,omitempty"`
|
||||
Value string `bson:"value,omitempty"`
|
||||
Use string `bson:"use,omitempty"`
|
||||
Rank int `bson:"rank,omitempty"`
|
||||
Period Period `bson:"period,omitempty"`
|
||||
}
|
||||
|
||||
type HumanName struct {
|
||||
Use string `bson:"use,omitempty"`
|
||||
Text string `bson:"text,omitempty"`
|
||||
Family string `bson:"family,omitempty"`
|
||||
Given []string `bson:"given,omitempty"`
|
||||
Prefix []string `bson:"prefix,omitempty"`
|
||||
Suffix []string `bson:"suffix,omitempty"`
|
||||
Period Period `bson:"period,omitempty"`
|
||||
}
|
||||
|
||||
type Address struct {
|
||||
Use string `bson:"use,omitempty"`
|
||||
Type string `bson:"type,omitempty"`
|
||||
Text string `bson:"text,omitempty"`
|
||||
Line []string `bson:"line,omitempty"`
|
||||
City string `bson:"city,omitempty"`
|
||||
District string `bson:"district,omitempty"`
|
||||
State string `bson:"state,omitempty"`
|
||||
PostalCode string `bson:"postalCode,omitempty"`
|
||||
Country string `bson:"country,omitempty"`
|
||||
Period Period `bson:"period,omitempty"`
|
||||
}
|
||||
|
||||
type Organization struct {
|
||||
Reference string `bson:"reference,omitempty"`
|
||||
}
|
||||
|
||||
type Contact struct {
|
||||
Relationship []CodeableConcept `bson:"relationship,omitempty"`
|
||||
Name []HumanName `bson:"name,omitempty"`
|
||||
Telecom []ContactPoint `bson:"telecom,omitempty"`
|
||||
Address Address `bson:"address,omitempty"`
|
||||
Organization Organization `bson:"organization,omitempty"`
|
||||
Gender string `bson:"gender,omitempty"`
|
||||
Period Period `bson:"period,omitempty"`
|
||||
}
|
||||
|
||||
type Communication struct {
|
||||
Language CodeableConcept `bson:"language,omitempty"`
|
||||
Preferred bool `bson:"preferred,omitempty"`
|
||||
}
|
||||
|
||||
type ReqInsertCommunication struct {
|
||||
Language Coding `bson:"language,omitempty"`
|
||||
Preferred bool `bson:"preferred,omitempty"`
|
||||
}
|
||||
|
||||
type Link struct {
|
||||
RelatePerson []RelatePerson `bson:"relatePerson,omitempty"`
|
||||
}
|
||||
|
||||
type RelatePerson struct {
|
||||
Identifier []Identifier `bson:"identifier,omitempty"`
|
||||
Active bool `bson:"active"`
|
||||
Patient string `bson:"patient"`
|
||||
Relationship CodeableConcept `bson:"relationship"`
|
||||
Name []HumanName `bson:"name,omitempty"`
|
||||
Telecom []ContactPoint `bson:"telecom,omitempty"`
|
||||
Gender string `bson:"gender,omitempty"`
|
||||
BirthDate string `bson:"birthDate,omitempty"`
|
||||
Address []Address `bson:"address,omitempty"`
|
||||
Photo string `bson:"photo,omitempty"`
|
||||
Period Period `bson:"period,omitempty"`
|
||||
Communication []Communication `bson:"communication,omitempty"`
|
||||
Preferred bool `bson:"preferred"`
|
||||
}
|
||||
|
||||
type Deceased struct {
|
||||
DeceasedBoolean bool `bson:"deceasedBoolean,omitempty"`
|
||||
DeceasedDateTime string `bson:"deceasedDateTime,omitempty"`
|
||||
}
|
||||
|
||||
type MultipleBirth struct {
|
||||
MultipleBirthBoolean bool `bson:"multipleBirthBoolean,omitempty"`
|
||||
MultipleBirthInteger int `bson:"multipleBirthInteger,omitempty"`
|
||||
}
|
||||
|
||||
type Patient struct {
|
||||
ResourceType string `bson:"resourceType"`
|
||||
ID string `bson:"_id"`
|
||||
Identifier []Identifier `bson:"identifier,omitempty"`
|
||||
Active bool `bson:"active"`
|
||||
Name []HumanName `bson:"name,omitempty"`
|
||||
Telecom []ContactPoint `bson:"telecom,omitempty"`
|
||||
Gender string `bson:"gender,omitempty"`
|
||||
BirthPlace string `bson:"birthPlace,omitempty"`
|
||||
BirthDate string `bson:"birthDate,omitempty"`
|
||||
Address []Address `bson:"address,omitempty"`
|
||||
MaritalStatus CodeableConcept `bson:"maritalStatus,omitempty"`
|
||||
Job CodeableConcept `bson:"job,omitempty"`
|
||||
Religion CodeableConcept `bson:"religion,omitempty"`
|
||||
Tribe CodeableConcept `bson:"tribe,omitempty"`
|
||||
Link Link `bson:"link,omitempty"`
|
||||
Communication []Communication `bson:"communication,omitempty"`
|
||||
Disability bool `bson:"disability,omitempty"`
|
||||
National string `bson:"national,omitempty"`
|
||||
Deceased Deceased `bson:"deceased,omitempty"`
|
||||
MultipleBirth MultipleBirth `bson:"multipleBirth,omitempty"`
|
||||
CreatedAt string `bson:"createdAt"`
|
||||
UpdatedAt string `bson:"updatedAt"`
|
||||
}
|
||||
|
||||
type ReqInsertIdentifier struct {
|
||||
Use string `bson:"use,omitempty"`
|
||||
Type Coding `bson:"type,omitempty"`
|
||||
System string `bson:"system,omitempty"`
|
||||
Value string `bson:"value,omitempty"`
|
||||
Period Period `bson:"period,omitempty"`
|
||||
}
|
||||
|
||||
type ReqInsertPatient struct {
|
||||
Identifier []ReqInsertIdentifier `bson:"identifier,omitempty"`
|
||||
Active bool `bson:"active"`
|
||||
Name []HumanName `bson:"name,omitempty"`
|
||||
Telecom []ContactPoint `bson:"telecom,omitempty"`
|
||||
Gender string `bson:"gender,omitempty"`
|
||||
BirthPlace string `bson:"birthPlace,omitempty"`
|
||||
BirthDate string `bson:"birthDate,omitempty"`
|
||||
Address []Address `bson:"address,omitempty"`
|
||||
MaritalStatus []CodeableConcept `bson:"maritalStatus,omitempty"`
|
||||
Job []CodeableConcept `bson:"job,omitempty"`
|
||||
Religion []CodeableConcept `bson:"religion,omitempty"`
|
||||
Tribe []CodeableConcept `bson:"tribe,omitempty"`
|
||||
Link Link `bson:"link,omitempty"`
|
||||
Communication []Communication `bson:"communication,omitempty"`
|
||||
Disability bool `bson:"disability,omitempty"`
|
||||
National string `bson:"national,omitempty"`
|
||||
Deceased Deceased `bson:"deceased,omitempty"`
|
||||
MultipleBirth MultipleBirth `bson:"multipleBirth,omitempty"`
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package satu_data
|
||||
|
||||
type PoliklinikGetData struct {
|
||||
ID string `gorm:"column:id" json:"id"`
|
||||
Nama string `gorm:"column:name" json:"nama"`
|
||||
Kode string `gorm:"column:kode" json:"kode"`
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package satu_data
|
||||
|
||||
type Retribusi struct {
|
||||
ID string `gorm:"column:id" json:"id"`
|
||||
Status string `gorm:"column:status" json:"status"`
|
||||
Sort int `gorm:"column:sort" json:"sort"`
|
||||
UserCreated string `gorm:"column:user_created" json:"user_created"`
|
||||
DateCreated string `gorm:"column:date_created" json:"date_created"`
|
||||
UserUpdated string `gorm:"column:user_updated" json:"user_updated"`
|
||||
DateUpdated string `gorm:"column:date_updated" json:"date_updated"`
|
||||
Jenis string `gorm:"column:Jenis" json:"Jenis"`
|
||||
Pelayanan string `gorm:"column:Pelayanan" json:"Pelayanan"`
|
||||
Dinas string `gorm:"column:Dinas" json:"Dinas"`
|
||||
KelompokObyek string `gorm:"column:Kelompok_obyek" json:"Kelompok_obyek"`
|
||||
KodeTarif string `gorm:"column:Kode_tarif" json:"Kode_tarif"`
|
||||
Tarif string `gorm:"column:Tarif" json:"Tarif"`
|
||||
Satuan string `gorm:"column:Satuan" json:"Satuan"`
|
||||
TarifOverTime string `gorm:"column:Tarif_overtime" json:"Tarif_overtime"`
|
||||
SatuanOverTime string `gorm:"column:Satuan_overtime" json:"Satuan_overtime"`
|
||||
RekeningPokok string `gorm:"column:Rekening_pokok" json:"Rekening_pokok"`
|
||||
RekeningDenda string `gorm:"column:Rekening_denda" json:"Rekening_denda"`
|
||||
Uraian1 string `gorm:"column:Uraian_1" json:"Uraian_1"`
|
||||
Uraian2 string `gorm:"column:Uraian_2" json:"Uraian_2"`
|
||||
Uraian3 string `gorm:"column:Uraian_3" json:"Uraian_3"`
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package user
|
||||
|
||||
type User struct {
|
||||
ID string `bson:"_id"`
|
||||
Name string `bson:"name"`
|
||||
Age int `bson:"age"`
|
||||
Address string `bson:"address"`
|
||||
Gender string `bson:"gender"`
|
||||
Religion string `bson:"religion"`
|
||||
}
|
||||
|
||||
type ReqInsertUser struct {
|
||||
ID string `bson:"_id"`
|
||||
Name string `bson:"name"`
|
||||
Age int `bson:"age"`
|
||||
Address string `bson:"address"`
|
||||
Gender string `bson:"gender"`
|
||||
Religion string `bson:"religion"`
|
||||
}
|
||||
|
||||
// USING INSERT AND UPDATE
|
||||
type ReqUpdateUser struct {
|
||||
ID string `json:"_id"`
|
||||
Name string `json:"name"`
|
||||
Age int `json:"age"`
|
||||
Address string `json:"address"`
|
||||
Gender string `json:"gender"`
|
||||
Religion string `json:"religion"`
|
||||
}
|
||||
|
||||
type ReqDeleteUser struct {
|
||||
ID string `json:"_id"`
|
||||
}
|
||||
Reference in New Issue
Block a user