update project name

This commit is contained in:
SowinskiBraeden committed 2023-09-26 21:00:18 -07:00
1 parent 6103b6d502
commit ecf4fabd86
14 files changed
+30 -30

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
export DB_URI=mongodb://localhost:27017 export DB_URI=mongodb://localhost:27017
export DB_NAME=SulliCartShare export DB_NAME=DeviceBookingAPI
export PORT=8000 export PORT=8000
export BASE_URL=localhost export BASE_URL=localhost
+1 -1
View File
@@ -1,2 +1,2 @@
# SulliCartShare Documentation # DeviceBookingAPI Documentation
+1 -1
View File
@@ -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. Backend API to manage the data handling, and checkout services for school resources such as Laptops, IPAD carts, etc.
+5 -5
View File
@@ -5,14 +5,14 @@ import (
"io" "io"
"net/http" "net/http"
"github.com/SowinskiBraeden/SulliCartShare/api" "github.com/SowinskiBraeden/DeviceBookingAPI/api"
"github.com/SowinskiBraeden/SulliCartShare/models" "github.com/SowinskiBraeden/DeviceBookingAPI/models"
"github.com/go-playground/validator/v10" "github.com/go-playground/validator/v10"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"go.uber.org/zap" "go.uber.org/zap"
"github.com/SowinskiBraeden/SulliCartShare/config" "github.com/SowinskiBraeden/DeviceBookingAPI/config"
"github.com/SowinskiBraeden/SulliCartShare/databases" "github.com/SowinskiBraeden/DeviceBookingAPI/databases"
) )
var validate = validator.New() var validate = validator.New()
@@ -73,7 +73,7 @@ func (a *App) Initialize() error {
zap.S().With(err).Error("failed to connect to database") zap.S().With(err).Error("failed to connect to database")
return err return err
} }
zap.S().Info("SulliCartShare has connected to the database") zap.S().Info("DeviceBookingAPI has connected to the database")
// initialize api router // initialize api router
a.initializeRoutes() a.initializeRoutes()
+2 -2
View File
@@ -10,8 +10,8 @@ import (
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/bson/primitive"
"github.com/SowinskiBraeden/SulliCartShare/config" "github.com/SowinskiBraeden/DeviceBookingAPI/config"
"github.com/SowinskiBraeden/SulliCartShare/models" "github.com/SowinskiBraeden/DeviceBookingAPI/models"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/thanhpk/randstr" "github.com/thanhpk/randstr"
) )
+3 -3
View File
@@ -11,9 +11,9 @@ import (
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/bson/primitive"
"github.com/SowinskiBraeden/SulliCartShare/config" "github.com/SowinskiBraeden/DeviceBookingAPI/config"
"github.com/SowinskiBraeden/SulliCartShare/databases" "github.com/SowinskiBraeden/DeviceBookingAPI/databases"
"github.com/SowinskiBraeden/SulliCartShare/models" "github.com/SowinskiBraeden/DeviceBookingAPI/models"
) )
type Cow struct { type Cow struct {
+8 -8
View File
@@ -11,16 +11,16 @@ import (
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/bson/primitive"
"github.com/SowinskiBraeden/SulliCartShare/config" "github.com/SowinskiBraeden/DeviceBookingAPI/config"
"github.com/SowinskiBraeden/SulliCartShare/databases" "github.com/SowinskiBraeden/DeviceBookingAPI/databases"
"github.com/SowinskiBraeden/SulliCartShare/models" "github.com/SowinskiBraeden/DeviceBookingAPI/models"
) )
type Device struct { type Device struct {
DB databases.DeviceDatabase DB databases.DeviceDatabase
} }
// CowHandler returns all cows // DeviceHandler returns all cows
func (d Device) DeviceHandler(w http.ResponseWriter, r *http.Request) { func (d Device) DeviceHandler(w http.ResponseWriter, r *http.Request) {
dbResp, err := d.DB.Find(context.TODO(), bson.M{}) dbResp, err := d.DB.Find(context.TODO(), bson.M{})
if err != nil { if err != nil {
@@ -42,7 +42,7 @@ func (d Device) DeviceHandler(w http.ResponseWriter, r *http.Request) {
w.Write(b) 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) { func (d Device) DeviceHandlerQuery(w http.ResponseWriter, r *http.Request) {
var query models.Query // Json data will represent the query model 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) 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) { func (d Device) DeviceByIDHandler(w http.ResponseWriter, r *http.Request) {
deviceID := mux.Vars(r)["cow_id"] deviceID := mux.Vars(r)["cow_id"]
@@ -97,7 +97,7 @@ func (d Device) DeviceByIDHandler(w http.ResponseWriter, r *http.Request) {
w.Write(b) 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) { func (d Device) NewDeviceHandler(w http.ResponseWriter, r *http.Request) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
var deviceDetails models.DeviceDetails // Json data will represent the cow details model 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) 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) { func (d Device) UpdateDeviceHandler(w http.ResponseWriter, r *http.Request) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
var newDetails models.DeviceDetails // Json data will represent the cow details model var newDetails models.DeviceDetails // Json data will represent the cow details model
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
"github.com/SowinskiBraeden/SulliCartShare/models" "github.com/SowinskiBraeden/DeviceBookingAPI/models"
"github.com/joho/godotenv" "github.com/joho/godotenv"
) )
+1 -1
View File
@@ -5,7 +5,7 @@ package databases
import ( import (
"context" "context"
"github.com/SowinskiBraeden/SulliCartShare/models" "github.com/SowinskiBraeden/DeviceBookingAPI/models"
) )
const cowName = "cows" const cowName = "cows"
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options" "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 // DatabaseHelper contains the collection and client to be used to access the methods
+1 -1
View File
@@ -5,7 +5,7 @@ package databases
import ( import (
"context" "context"
"github.com/SowinskiBraeden/SulliCartShare/models" "github.com/SowinskiBraeden/DeviceBookingAPI/models"
) )
const deviceName = "devices" const deviceName = "devices"
+1 -1
View File
@@ -1,4 +1,4 @@
module github.com/SowinskiBraeden/SulliCartShare module github.com/SowinskiBraeden/DeviceBookingAPI
go 1.19 go 1.19
+3 -3
View File
@@ -6,8 +6,8 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
"github.com/SowinskiBraeden/SulliCartShare/api/handlers" "github.com/SowinskiBraeden/DeviceBookingAPI/api/handlers"
"github.com/SowinskiBraeden/SulliCartShare/config" "github.com/SowinskiBraeden/DeviceBookingAPI/config"
) )
func main() { func main() {
@@ -20,6 +20,6 @@ func main() {
return 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)) log.Fatal(http.ListenAndServe(":"+a.Config.Port, a.Router))
} }
+1 -1
View File
@@ -8,7 +8,7 @@ type Device struct {
// Device holds the structure for the Device collection in mongo // Device holds the structure for the Device collection in mongo
type DeviceDetails struct { 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 Name string `json:"name" bson:"Name"` // eg. SULH-LAP-01
Parent string `json:"parent" bson:"Parent"` // Parent cow ID Parent string `json:"parent" bson:"Parent"` // Parent cow ID
} }