Nodes become unpublished when I restart service or debugging session, 16.4

So, simple, when I restart service on Linux server or restart debugging session, the published info is lost, not sure where or how: https://youtu.be/Ul6_TPXe0Fw?si=jW99xyMci5rmWuyG but my endpoint is not serving it any more.

I am very tired, and this upgrade is one big mess, client is pissed off, as they have every right to be.

using Microsoft.AspNetCore.Mvc;

using Umbraco.Cms.Core.Services;

using Umbraco.Cms.Core.Web;

using Umbraco.Cms.Web.Common.Controllers;

using Umbraco.Cms.Core.Models.PublishedContent;

using System.Linq;

using Umbraco.Cms.Core;

using Umbraco.Extensions;

using Swashbuckle.AspNetCore.Annotations;




namespace Proj.Core.Controllers

{

    [ApiController]

    [Route("umbraco/api/[controller]")]

    public class CountriesController : ControllerBase

    {

        private readonly IUmbracoContextFactory _contextFactory;

        private readonly IPublishedContentQuery _contentQuery;




        public CountriesController(IUmbracoContextFactory contextFactory, IPublishedContentQuery contentQuery)

        {

            _contextFactory = contextFactory;

            _contentQuery = contentQuery;

        }




        private string MapCulture(string shortCulture)

        {

            return shortCulture?.ToLower() switch

            {

                "en" => "en-us",

                "nl" => "nl-nl",

                "de" => "de-de",

                _ => "en-us" // Default to "en-us" if no match is found

            };

        }




        [HttpGet]

        [SwaggerOperation(Summary = "Returns countries", Description = "All defined countries are in response. Supports filtering by name and locale.")]

        [SwaggerResponse(404, "Not Found")]

        [SwaggerResponse(400, "Bad Request")]

        public IActionResult GetCountries(

            [FromQuery] string locale = "en",

            [FromQuery(Name = "filters[name][$contains]")] string nameContains = null,

            [FromQuery(Name = "populate")] string populate = null)

        {

            if (locale != null && locale != "en" && locale != "nl" && locale != "de")

            {

                return BadRequest("Invalid locale. Supported values are 'en', 'nl', and 'de'.");

            }




            var culture = MapCulture(locale);




            using (_contextFactory.EnsureUmbracoContext())

            {

                var countriesNode = _contentQuery.ContentAtRoot().FirstOrDefault(x => x.ContentType.Alias == "countriesSTRRAPI");

                if (countriesNode == null)

                {

                    return NotFound("Countries node not found");

                }




                // Apply filters

                var countries = countriesNode.Children().Where(country => country.IsPublished(culture));




                if (!string.IsNullOrEmpty(nameContains))

                {

                    countries = countries.Where(country => 

                        country.Name(culture)?.IndexOf(nameContains, StringComparison.OrdinalIgnoreCase) >= 0);

                }




                var countriesList = countries.ToList();




                // Prepare the response

                var response = new

                {

                    data = countriesList.Select(country => new

                    {

                        id = country.Id,

                        attributes = new

                        {

                            name = country.Name(culture),

                            iso = country.Value<string>("iso"),

                            status = country.Value<bool>("status"),

                            citySelection = country.Value<bool>("citySelection"),

                            telephoneCode = country.Value<string>("telephoneCode"),

                            createdAt = country.CreateDate.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"),

                            updatedAt = country.UpdateDate.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"),

                            publishedAt = country.CreateDate.Date.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"),

                            locale = locale

                        }

                    }).ToList(),

                    meta = new

                    {

                        pagination = new

                        {

                            page = 1,

                            pageSize = 25,

                            pageCount = 1,

                            total = countriesList.Count

                        }

                    }

                };




                return Ok(response);

            }

        }

    }

}