Compare commits

..

3 Commits

Author SHA1 Message Date
bf1c8e0a85 🗃️ Remove some unused outdated fields 2025-10-26 02:41:30 +08:00
323fa8ee15 🐛 Bug fixes 2025-10-26 02:41:17 +08:00
e7a46e96ed 🔨 Republish to generate docker compose 2025-10-26 02:25:25 +08:00
11 changed files with 2059 additions and 52 deletions

View File

@@ -4,11 +4,7 @@ using DysonNetwork.Shared.Models;
namespace DysonNetwork.Develop.Project;
public class DevProjectService(
AppDatabase db,
FileReferenceService.FileReferenceServiceClient fileRefs,
FileService.FileServiceClient files
)
public class DevProjectService(AppDatabase db )
{
public async Task<SnDevProject> CreateProjectAsync(
SnDeveloper developer,
@@ -25,14 +21,14 @@ public class DevProjectService(
db.DevProjects.Add(project);
await db.SaveChangesAsync();
return project;
}
public async Task<SnDevProject?> GetProjectAsync(Guid id, Guid? developerId = null)
{
var query = db.DevProjects.AsQueryable();
if (developerId.HasValue)
{
query = query.Where(p => p.DeveloperId == developerId.Value);
@@ -74,4 +70,4 @@ public class DevProjectService(
await db.SaveChangesAsync();
return true;
}
}
}

View File

@@ -19,9 +19,6 @@ public class SnActivity : ModelBase
public object? Data { get; set; }
// Outdated fields, for backward compability
public int Visibility => 0;
public static SnActivity Empty()
{
var now = SystemClock.Instance.GetCurrentInstant();

View File

@@ -20,10 +20,6 @@ public class SnChatRoom : ModelBase, IIdentifiedResource
public bool IsCommunity { get; set; }
public bool IsPublic { get; set; }
// Outdated fields, for backward compability
[MaxLength(32)] public string? PictureId { get; set; }
[MaxLength(32)] public string? BackgroundId { get; set; }
[Column(TypeName = "jsonb")] public SnCloudFileReferenceObject? Picture { get; set; }
[Column(TypeName = "jsonb")] public SnCloudFileReferenceObject? Background { get; set; }

View File

@@ -22,10 +22,6 @@ public class SnPublisher : ModelBase, IIdentifiedResource
[MaxLength(256)] public string Nick { get; set; } = string.Empty;
[MaxLength(4096)] public string? Bio { get; set; }
// Outdated fields, for backward compability
[MaxLength(32)] public string? PictureId { get; set; }
[MaxLength(32)] public string? BackgroundId { get; set; }
[Column(TypeName = "jsonb")] public SnCloudFileReferenceObject? Picture { get; set; }
[Column(TypeName = "jsonb")] public SnCloudFileReferenceObject? Background { get; set; }

View File

@@ -17,10 +17,6 @@ public class SnRealm : ModelBase, IIdentifiedResource
[MaxLength(4096)] public string Description { get; set; } = string.Empty;
public bool IsCommunity { get; set; }
public bool IsPublic { get; set; }
// Outdated fields, for backward compability
[MaxLength(32)] public string? PictureId { get; set; }
[MaxLength(32)] public string? BackgroundId { get; set; }
[Column(TypeName = "jsonb")] public SnCloudFileReferenceObject? Picture { get; set; }
[Column(TypeName = "jsonb")] public SnCloudFileReferenceObject? Background { get; set; }

View File

@@ -9,6 +9,7 @@ import "google/protobuf/wrappers.proto";
import "google/protobuf/empty.proto";
import 'account.proto';
import "file.proto";
// Message Definitions
@@ -18,6 +19,11 @@ message Realm {
string slug = 3;
bool is_community = 4;
bool is_public = 5;
string description = 6;
optional CloudFile picture = 7;
optional CloudFile background = 8;
optional VerificationMark verification = 9;
string account_id = 10;
}
message RealmMember {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,62 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class RemoveOutdatedFileIds : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "background_id",
table: "publishers");
migrationBuilder.DropColumn(
name: "picture_id",
table: "publishers");
migrationBuilder.DropColumn(
name: "background_id",
table: "chat_rooms");
migrationBuilder.DropColumn(
name: "picture_id",
table: "chat_rooms");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "background_id",
table: "publishers",
type: "character varying(32)",
maxLength: 32,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "picture_id",
table: "publishers",
type: "character varying(32)",
maxLength: 32,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "background_id",
table: "chat_rooms",
type: "character varying(32)",
maxLength: 32,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "picture_id",
table: "chat_rooms",
type: "character varying(32)",
maxLength: 32,
nullable: true);
}
}
}

View File

@@ -23,7 +23,7 @@ namespace DysonNetwork.Sphere.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.9")
.HasAnnotation("ProductVersion", "9.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@@ -252,11 +252,6 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("jsonb")
.HasColumnName("background");
b.Property<string>("BackgroundId")
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasColumnName("background_id");
b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
@@ -287,11 +282,6 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("jsonb")
.HasColumnName("picture");
b.Property<string>("PictureId")
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasColumnName("picture_id");
b.Property<Guid?>("RealmId")
.HasColumnType("uuid")
.HasColumnName("realm_id");
@@ -920,11 +910,6 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("jsonb")
.HasColumnName("background");
b.Property<string>("BackgroundId")
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasColumnName("background_id");
b.Property<string>("Bio")
.HasMaxLength(4096)
.HasColumnType("character varying(4096)")
@@ -954,11 +939,6 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("jsonb")
.HasColumnName("picture");
b.Property<string>("PictureId")
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasColumnName("picture_id");
b.Property<Guid?>("RealmId")
.HasColumnType("uuid")
.HasColumnName("realm_id");
@@ -1704,7 +1684,7 @@ namespace DysonNetwork.Sphere.Migrations
modelBuilder.Entity("DysonNetwork.Shared.Models.SnPostFeaturedRecord", b =>
{
b.HasOne("DysonNetwork.Shared.Models.SnPost", "Post")
.WithMany()
.WithMany("FeaturedRecords")
.HasForeignKey("PostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
@@ -1924,6 +1904,8 @@ namespace DysonNetwork.Sphere.Migrations
{
b.Navigation("Awards");
b.Navigation("FeaturedRecords");
b.Navigation("Reactions");
});

View File

@@ -36,3 +36,6 @@ DEVELOP_IMAGE=develop:latest
# Container image name for gateway
GATEWAY_IMAGE=gateway:latest
# Container image name for insight
INSIGHT_IMAGE=insight:latest

View File

@@ -8,7 +8,7 @@ services:
- "aspire"
restart: "always"
cache:
image: "docker.io/library/redis:7.4"
image: "docker.io/library/redis:8.2"
command:
- "-c"
- "redis-server --requirepass $$REDIS_PASSWORD"
@@ -41,6 +41,7 @@ services:
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
HTTP_PORTS: "8080"
HTTPS_PORTS: "7001"
ConnectionStrings__cache: "cache:6379,password=${CACHE_PASSWORD}"
ConnectionStrings__queue: "nats://nats:${QUEUE_PASSWORD}@queue:4222"
services__pass__http__0: "http://pass:8080"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://docker-compose-dashboard:18889"
@@ -60,9 +61,11 @@ services:
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
HTTP_PORTS: "8080"
HTTPS_PORTS: "7001"
services__ring__http__0: "http://ring:8080"
services__develop__http__0: "http://develop:8080"
services__drive__http__0: "http://drive:8080"
ConnectionStrings__cache: "cache:6379,password=${CACHE_PASSWORD}"
ConnectionStrings__queue: "nats://nats:${QUEUE_PASSWORD}@queue:4222"
services__ring__http__0: "http://ring:8080"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://docker-compose-dashboard:18889"
OTEL_EXPORTER_OTLP_PROTOCOL: "grpc"
OTEL_SERVICE_NAME: "pass"
@@ -80,10 +83,10 @@ services:
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
HTTP_PORTS: "8080"
HTTPS_PORTS: "7001"
ConnectionStrings__cache: "cache:6379,password=${CACHE_PASSWORD}"
ConnectionStrings__queue: "nats://nats:${QUEUE_PASSWORD}@queue:4222"
services__pass__http__0: "http://pass:8080"
services__ring__http__0: "http://ring:8080"
ConnectionStrings__cache: "cache:6379,password=${CACHE_PASSWORD}"
ConnectionStrings__queue: "nats://nats:${QUEUE_PASSWORD}@queue:4222"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://docker-compose-dashboard:18889"
OTEL_EXPORTER_OTLP_PROTOCOL: "grpc"
OTEL_SERVICE_NAME: "drive"
@@ -101,11 +104,11 @@ services:
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
HTTP_PORTS: "8080"
HTTPS_PORTS: "7001"
ConnectionStrings__cache: "cache:6379,password=${CACHE_PASSWORD}"
ConnectionStrings__queue: "nats://nats:${QUEUE_PASSWORD}@queue:4222"
services__pass__http__0: "http://pass:8080"
services__ring__http__0: "http://ring:8080"
services__drive__http__0: "http://drive:8080"
ConnectionStrings__cache: "cache:6379,password=${CACHE_PASSWORD}"
ConnectionStrings__queue: "nats://nats:${QUEUE_PASSWORD}@queue:4222"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://docker-compose-dashboard:18889"
OTEL_EXPORTER_OTLP_PROTOCOL: "grpc"
OTEL_SERVICE_NAME: "sphere"
@@ -123,9 +126,11 @@ services:
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
HTTP_PORTS: "8080"
HTTPS_PORTS: "7001"
ConnectionStrings__cache: "cache:6379,password=${CACHE_PASSWORD}"
services__pass__http__0: "http://pass:8080"
services__ring__http__0: "http://ring:8080"
services__sphere__http__0: "http://sphere:8080"
ConnectionStrings__cache: "cache:6379,password=${CACHE_PASSWORD}"
ConnectionStrings__queue: "nats://nats:${QUEUE_PASSWORD}@queue:4222"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://docker-compose-dashboard:18889"
OTEL_EXPORTER_OTLP_PROTOCOL: "grpc"
OTEL_SERVICE_NAME: "develop"
@@ -134,6 +139,29 @@ services:
- "7001"
networks:
- "aspire"
insight:
image: "${INSIGHT_IMAGE}"
environment:
OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES: "true"
OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES: "true"
OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY: "in_memory"
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
HTTP_PORTS: "8080"
HTTPS_PORTS: "7001"
services__pass__http__0: "http://pass:8080"
services__ring__http__0: "http://ring:8080"
services__sphere__http__0: "http://sphere:8080"
services__develop__http__0: "http://develop:8080"
ConnectionStrings__cache: "cache:6379,password=${CACHE_PASSWORD}"
ConnectionStrings__queue: "nats://nats:${QUEUE_PASSWORD}@queue:4222"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://docker-compose-dashboard:18889"
OTEL_EXPORTER_OTLP_PROTOCOL: "grpc"
OTEL_SERVICE_NAME: "insight"
expose:
- "8080"
- "7001"
networks:
- "aspire"
gateway:
image: "${GATEWAY_IMAGE}"
environment:
@@ -147,6 +175,7 @@ services:
services__drive__http__0: "http://drive:8080"
services__sphere__http__0: "http://sphere:8080"
services__develop__http__0: "http://develop:8080"
services__insight__http__0: "http://insight:8080"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://docker-compose-dashboard:18889"
OTEL_EXPORTER_OTLP_PROTOCOL: "grpc"
OTEL_SERVICE_NAME: "gateway"