update project name
This commit is contained in:
14 files changed
+30
-30
No files matched your search
+1
-1
@@ -1,5 +1,5 @@
|
||||
export DB_URI=mongodb://localhost:27017
|
||||
export DB_NAME=SulliCartShare
|
||||
export DB_NAME=DeviceBookingAPI
|
||||
|
||||
export PORT=8000
|
||||
export BASE_URL=localhost
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
# SulliCartShare Documentation
|
||||
# DeviceBookingAPI Documentation
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# SulliCartShare
|
||||
# DeviceBookingAPI
|
||||
|
||||
Backend API to manage the data handling, and checkout services for school resources such as Laptops, IPAD carts, etc.
|
||||
+5
-5
@@ -5,14 +5,14 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/SowinskiBraeden/SulliCartShare/api"
|
||||
"github.com/SowinskiBraeden/SulliCartShare/models"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/api"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/models"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"github.com/gorilla/mux"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/SowinskiBraeden/SulliCartShare/config"
|
||||
"github.com/SowinskiBraeden/SulliCartShare/databases"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/config"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/databases"
|
||||
)
|
||||
|
||||
var validate = validator.New()
|
||||
@@ -73,7 +73,7 @@ func (a *App) Initialize() error {
|
||||
zap.S().With(err).Error("failed to connect to database")
|
||||
return err
|
||||
}
|
||||
zap.S().Info("SulliCartShare has connected to the database")
|
||||
zap.S().Info("DeviceBookingAPI has connected to the database")
|
||||
|
||||
// initialize api router
|
||||
a.initializeRoutes()
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
||||
"github.com/SowinskiBraeden/SulliCartShare/config"
|
||||
"github.com/SowinskiBraeden/SulliCartShare/models"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/config"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/models"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/thanhpk/randstr"
|
||||
)
|
||||
|
||||
+3
-3
@@ -11,9 +11,9 @@ import (
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
||||
"github.com/SowinskiBraeden/SulliCartShare/config"
|
||||
"github.com/SowinskiBraeden/SulliCartShare/databases"
|
||||
"github.com/SowinskiBraeden/SulliCartShare/models"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/config"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/databases"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/models"
|
||||
)
|
||||
|
||||
type Cow struct {
|
||||
|
||||
@@ -11,16 +11,16 @@ import (
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
||||
"github.com/SowinskiBraeden/SulliCartShare/config"
|
||||
"github.com/SowinskiBraeden/SulliCartShare/databases"
|
||||
"github.com/SowinskiBraeden/SulliCartShare/models"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/config"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/databases"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/models"
|
||||
)
|
||||
|
||||
type Device struct {
|
||||
DB databases.DeviceDatabase
|
||||
}
|
||||
|
||||
// CowHandler returns all cows
|
||||
// DeviceHandler returns all cows
|
||||
func (d Device) DeviceHandler(w http.ResponseWriter, r *http.Request) {
|
||||
dbResp, err := d.DB.Find(context.TODO(), bson.M{})
|
||||
if err != nil {
|
||||
@@ -42,7 +42,7 @@ func (d Device) DeviceHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write(b)
|
||||
}
|
||||
|
||||
// CowHandlerQuery is the same as CowHanlder, but queries a specific list of objects by Name
|
||||
// DeviceHandlerQuery is the same as DeviceHandler, but queries a specific list of objects by Name
|
||||
func (d Device) DeviceHandlerQuery(w http.ResponseWriter, r *http.Request) {
|
||||
var query models.Query // Json data will represent the query model
|
||||
|
||||
@@ -78,7 +78,7 @@ func (d Device) DeviceHandlerQuery(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write(b)
|
||||
}
|
||||
|
||||
// CowByIDHandler returns a cow by ID
|
||||
// DeviceByIDHandler returns a cow by ID
|
||||
func (d Device) DeviceByIDHandler(w http.ResponseWriter, r *http.Request) {
|
||||
deviceID := mux.Vars(r)["cow_id"]
|
||||
|
||||
@@ -97,7 +97,7 @@ func (d Device) DeviceByIDHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write(b)
|
||||
}
|
||||
|
||||
// NewCowHandler inserts a new cow into the collection and returns a result and error
|
||||
// NewDeviceHandler inserts a new cow into the collection and returns a result and error
|
||||
func (d Device) NewDeviceHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
var deviceDetails models.DeviceDetails // Json data will represent the cow details model
|
||||
@@ -135,7 +135,7 @@ func (d Device) NewDeviceHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write(b)
|
||||
}
|
||||
|
||||
// UpdateCowHandler gets updates the data for an existing cow and returns a result and error
|
||||
// UpdateDeviceHandler gets updates the data for an existing cow and returns a result and error
|
||||
func (d Device) UpdateDeviceHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
var newDetails models.DeviceDetails // Json data will represent the cow details model
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/SowinskiBraeden/SulliCartShare/models"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/models"
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ package databases
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/SowinskiBraeden/SulliCartShare/models"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/models"
|
||||
)
|
||||
|
||||
const cowName = "cows"
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
|
||||
"github.com/SowinskiBraeden/SulliCartShare/config"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/config"
|
||||
)
|
||||
|
||||
// DatabaseHelper contains the collection and client to be used to access the methods
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ package databases
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/SowinskiBraeden/SulliCartShare/models"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/models"
|
||||
)
|
||||
|
||||
const deviceName = "devices"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module github.com/SowinskiBraeden/SulliCartShare
|
||||
module github.com/SowinskiBraeden/DeviceBookingAPI
|
||||
|
||||
go 1.19
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/SowinskiBraeden/SulliCartShare/api/handlers"
|
||||
"github.com/SowinskiBraeden/SulliCartShare/config"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/api/handlers"
|
||||
"github.com/SowinskiBraeden/DeviceBookingAPI/config"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -20,6 +20,6 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
zap.S().Infow("SulliCartShare is up and running", "url", a.Config.BaseURL, "port", a.Config.Port)
|
||||
zap.S().Infow("DeviceBookingAPI is up and running", "url", a.Config.BaseURL, "port", a.Config.Port)
|
||||
log.Fatal(http.ListenAndServe(":"+a.Config.Port, a.Router))
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ type Device struct {
|
||||
|
||||
// Device holds the structure for the Device collection in mongo
|
||||
type DeviceDetails struct {
|
||||
Type string `json:"type" bson:"Type"` // eg. Laptop, Ipdad, etc
|
||||
Type string `json:"type" bson:"Type"` // eg. Laptop, Ipad, etc
|
||||
Name string `json:"name" bson:"Name"` // eg. SULH-LAP-01
|
||||
Parent string `json:"parent" bson:"Parent"` // Parent cow ID
|
||||
}
|
||||
Reference in new issue
Block a user