Catalog Service

Overview

The Catalog Service is a RESTful API built with Go that manages a product catalog. It provides CRUD (Create, Read, Update, Delete) .The service uses SQLite for data storage.

Prerequisites

  • Go 1.16 or later
  • SQLite

Running the Service

Start the service:

go run main.go

The service will start on http://localhost:8080.

API Endpoints

  • GET /items: Retrieve all catalog items
  • POST /items: Create a new catalog item
  • GET /items/{id}: Retrieve a specific catalog item
  • PUT /items/{id}: Update a specific catalog item
  • DELETE /items/{id}: Delete a specific catalog item

All endpoints require a valid JWT token in the Authorization header.

Data Model

The Item struct represents a catalog item:

type Item struct {
    ID        int       `json:"id"`
    Name      string    `json:"name"`
    Type      string    `json:"type"`
    CreatedAt time.Time `json:"created_at"`
    ChangedAt time.Time `json:"changed_at"`
    CreatedBy string    `json:"created_by"`
    ChangedBy string    `json:"changed_by"`
    IsDeleted bool      `json:"is_deleted"`
}