This commit is contained in:
2022-03-10 23:32:33 +00:00
parent 3591907b41
commit 0784313e6d
5 changed files with 62 additions and 17 deletions

View File

@@ -508,7 +508,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
await ExecQueryAsync("CREATE TABLE alicense (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, licenseagree BOOL NOT NULL, dbid TEXT, key TEXT NOT NULL)");
await ExecQueryAsync("CREATE TABLE afileattachment (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, "
+ "attachtoobjectid BIGINT NOT NULL, attachtoatype INTEGER NOT NULL, "
+ "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)

View File

@@ -436,8 +436,15 @@ namespace AyaNova.Util
/// Store a file attachment
/// </summary>
/// <returns></returns>
internal static async Task<FileAttachment> StoreFileAttachmentAsync(string tempFilePath, string contentType, string fileName, DateTime lastModified,
AyaTypeId attachToObject, string notes, AyContext ct)
internal static async Task<FileAttachment> StoreFileAttachmentAsync(
string tempFilePath,
string contentType,
string fileName,
DateTime lastModified,
AyaTypeId attachToObject,
string notes,
long attachedByUserId,
AyContext ct)
{
//calculate hash
var hash = FileHash.GetChecksum(tempFilePath);
@@ -473,7 +480,8 @@ namespace AyaNova.Util
AttachToObjectId = attachToObject.ObjectId,
AttachToAType = attachToObject.AType,
LastModified = lastModified,
Size = FileSize
Size = FileSize,
AttachedByUserId=attachedByUserId
};