This commit is contained in:
2022-12-26 18:03:46 +00:00
parent 19e0037511
commit fac5b03007
9 changed files with 158 additions and 81 deletions

View File

@@ -597,7 +597,7 @@ namespace Sockeye.Api.Controllers
await ct.Database.OpenConnectionAsync();
cmd.CommandText = $@"select afileattachment.id, afileattachment.xmin as concurrency, displayfilename,contenttype,lastmodified, afileattachment.notes, size, auser.name as attachedbyuser from afileattachment
left join auser on (afileattachment.attachedByUserId=auser.id)
where attachtosockType={(int)sockType} and attachtoobjectid={sockId}
where attachtoatype={(int)sockType} and attachtoobjectid={sockId}
order by displayfilename";
using (var dr = await cmd.ExecuteReaderAsync())

View File

@@ -52,8 +52,8 @@ namespace Sockeye.DataList
FieldKey = "object",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlIdColumnName = "afileattachment.AttachToObjectid",
SqlValueColumnName = $"AYGETNAME(afileattachment.AttachToObjectid, afileattachment.attachtosockType,{translationId})",
SqlATypeColumnName = "afileattachment.attachtosockType",
SqlValueColumnName = $"AYGETNAME(afileattachment.AttachToObjectid, afileattachment.attachtoatype,{translationId})",
SqlATypeColumnName = "afileattachment.attachtoatype",
Translate = true
});

View File

@@ -51,6 +51,19 @@ namespace Sockeye.Biz
case SockType.Review:
return await ct.Review.AnyAsync(z => z.Id == id);
case SockType.License:
return await ct.License.AnyAsync(z => z.Id == id);
case SockType.TrialLicenseRequest:
return await ct.TrialLicenseRequest.AnyAsync(z => z.Id == id);
case SockType.SubscriptionServer:
return await ct.SubscriptionServer.AnyAsync(z => z.Id == id);
case SockType.Purchase:
return await ct.Purchase.AnyAsync(z => z.Id == id);
case SockType.Product:
return await ct.Product.AnyAsync(z => z.Id == id);
case SockType.GZCase:
return await ct.GZCase.AnyAsync(z => z.Id == id);
case SockType.CustomerNotifySubscription:
return await ct.CustomerNotifySubscription.AnyAsync(z => z.Id == id);

View File

@@ -429,7 +429,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
await ExecQueryAsync("CREATE TABLE afileattachment (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, "
+ "attachtoobjectid BIGINT NOT NULL, attachtosockType INTEGER NOT NULL, attachedbyuserid BIGINT NOT NULL REFERENCES auser (id), "
+ "attachtoobjectid BIGINT NOT NULL, attachtoatype INTEGER NOT NULL, attachedbyuserid BIGINT NOT NULL REFERENCES auser (id), "
+ "storedfilename TEXT NOT NULL, displayfilename TEXT NOT NULL, contenttype TEXT, lastmodified TIMESTAMPTZ NOT NULL, notes TEXT, exists BOOL NOT NULL, size BIGINT NOT NULL)");
//index required for ops that need to check if file already in db (delete, count refs etc)
@@ -438,7 +438,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
//index for the common issue of checking if an object has an attachment and retrieving them
//note always query (where clause) in this same order for best performance
await ExecQueryAsync("CREATE INDEX idx_afileattachment_attachtoobjectid_attachtosockType ON afileattachment (attachtoobjectid, attachtosockType );");
await ExecQueryAsync("CREATE INDEX idx_afileattachment_attachtoobjectid_attachtoaType ON afileattachment (attachtoobjectid, attachtoaType );");
await ExecQueryAsync("CREATE TABLE aopsjob (gid uuid PRIMARY KEY, name TEXT NOT NULL, created TIMESTAMPTZ NOT NULL, exclusive BOOL NOT NULL, "
+ "startafter TIMESTAMPTZ NOT NULL, jobtype INTEGER NOT NULL, subtype INTEGER, objectid BIGINT, sockType INTEGER, jobstatus INTEGER NOT NULL, jobinfo TEXT)");