mirror of
https://github.com/hanzoai/jube-fork.git
synced 2026-10-30 18:33:33 +00:00
* Fixed audit record mapping error in datasource update that was causing failures. * Refactored fill series to use transactional column replacement after query introspection, with new repository delete methods. * Added backend parameter validation and default handling for visualization requests. * Fixed JavaScript parameter serialization issues and set explicit Content-Type headers for proper Web API deserialization. * Refactored visualization recall controller for cleaner code and moved mutable audit logic from query to controller.
58 lines
2.6 KiB
C#
58 lines
2.6 KiB
C#
/* Copyright (C) 2022-present Jube Holdings Limited.
|
|
*
|
|
* This file is part of Jube™ software.
|
|
*
|
|
* Jube™ is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License
|
|
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
* Jube™ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU Affero General Public License along with Jube™. If not,
|
|
* see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
namespace Jube.Data.Repository
|
|
{
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Context;
|
|
using LinqToDB;
|
|
using Poco;
|
|
|
|
public class VisualisationRegistryDatasourceSeriesRepository
|
|
{
|
|
private readonly DbContext dbContext;
|
|
private readonly int tenantRegistryId;
|
|
|
|
public VisualisationRegistryDatasourceSeriesRepository(DbContext dbContext, string userName)
|
|
{
|
|
this.dbContext = dbContext;
|
|
tenantRegistryId = this.dbContext.UserInTenant.Where(w => w.User == userName)
|
|
.Select(s => s.TenantRegistryId).FirstOrDefault();
|
|
}
|
|
|
|
public VisualisationRegistryDatasourceSeriesRepository(DbContext dbContext)
|
|
{
|
|
this.dbContext = dbContext;
|
|
}
|
|
|
|
public Task<int> DeleteByVisualisationRegistryDatasourceIdAsync(int visualisationRegistryDatasourceId)
|
|
{
|
|
return dbContext.VisualisationRegistryDatasourceSeries.DeleteAsync(d => d.VisualisationRegistryDatasourceId == visualisationRegistryDatasourceId);
|
|
}
|
|
|
|
public async Task<IEnumerable<VisualisationRegistryDatasourceSeries>> GetByVisualisationRegistryDatasourceIdAsync(
|
|
int visualisationRegistryDatasourceId, CancellationToken token = default)
|
|
{
|
|
return await dbContext.VisualisationRegistryDatasourceSeries
|
|
.Where(w => w.VisualisationRegistryDatasource.VisualisationRegistry.TenantRegistryId ==
|
|
tenantRegistryId
|
|
&& w.VisualisationRegistryDatasourceId == visualisationRegistryDatasourceId &&
|
|
(w.VisualisationRegistryDatasource.Deleted == 0 ||
|
|
w.VisualisationRegistryDatasource.Deleted == null)).ToListAsync(token);
|
|
}
|
|
}
|
|
}
|