package company_category import ( "tm/pkg/mongo" "go.mongodb.org/mongo-driver/v2/bson" ) type Category struct { mongo.Model `bson:",inline"` Name string `bson:"name" json:"name"` Description *string `bson:"description" json:"description"` Thumbnail *string `bson:"thumbnail" json:"thumbnail"` Published bool `bson:"published" json:"published"` PublishedAt *int64 `bson:"published_at" json:"published_at"` } // SetID sets the category ID (implements IDSetter interface) func (c *Category) SetID(id string) { c.ID, _ = bson.ObjectIDFromHex(id) } // GetID returns the category ID (implements IDGetter interface) func (c *Category) GetID() string { return c.ID.Hex() } // SetCreatedAt sets the created timestamp (implements Timestamp interface) func (c *Category) SetCreatedAt(timestamp int64) { c.CreatedAt = timestamp } // SetUpdatedAt sets the updated timestamp (implements Timestamp interface) func (c *Category) SetUpdatedAt(timestamp int64) { c.UpdatedAt = timestamp } // GetCreatedAt returns the created timestamp (implements Timestamp interface) func (c *Category) GetCreatedAt() int64 { return c.CreatedAt } // GetUpdatedAt returns the updated timestamp (implements Timestamp interface) func (c *Category) GetUpdatedAt() int64 { return c.UpdatedAt }