feat(publish): set version as latest and add release date on publish

This commit is contained in:
Avinash Sridhar 2025-05-27 11:32:56 -04:00 • committed by Toby Padilla
commit dd57b82859

View file

@ -6,6 +6,7 @@ import (
"strconv"
"strings"
"sync"
"time"
"github.com/google/uuid"
"github.com/modelcontextprotocol/registry/internal/model"
@ -234,6 +235,8 @@ func (db *MemoryDB) Publish(ctx context.Context, serverDetail *model.ServerDetai
// Generate a new ID for the server detail
serverDetail.ID = uuid.New().String()
serverDetail.VersionDetail.IsLatest = true // Assume the new version is the latest
serverDetail.VersionDetail.ReleaseDate = time.Now().Format(time.RFC3339)
// Store a copy of the entire ServerDetail
serverDetailCopy := *serverDetail
db.entries[serverDetail.ID] = &serverDetailCopy