Employee > ApplicationUser
ApplicationUser wird spezieller für Rechte verwendet.
This commit is contained in:
@@ -99,10 +99,11 @@ namespace BeWo.ViewModel
|
||||
return;
|
||||
|
||||
_SubPrompts.VMList.ListChanged += (s, e) => {
|
||||
FirePropertyChanged(nameof(Displayname));
|
||||
|
||||
if (e.ListChangedType == System.ComponentModel.ListChangedType.ItemChanged)
|
||||
return;
|
||||
|
||||
FirePropertyChanged(nameof(Displayname));
|
||||
FirePropertyChanged(nameof(Prompts));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace BeWo.Data.Entities
|
||||
|
||||
public virtual string PromptId { get; set; }
|
||||
|
||||
public virtual IList<ApplicationUser> UserFavorites { get; set;} = new List<ApplicationUser>();
|
||||
public virtual IList<Employee> UserFavorites { get; set;} = new List<Employee>();
|
||||
}
|
||||
|
||||
public class AiPromptbausteinPromptPromptIdComparer : IEqualityComparer<AiPromptbausteinPrompt>
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
<property name="OwnsoftRefLink"/>
|
||||
<property name="PromptId"/>
|
||||
|
||||
<bag name="UserFavorites" table="aipromptbausteinprompt2userfavorite" generic="true" cascade="none" batch-size="250">
|
||||
<bag name="UserFavorites" table="aipromptbausteinprompt2empfavorite" generic="true" cascade="none" batch-size="250">
|
||||
<key column="AiPromptbausteinPromptOid" />
|
||||
<many-to-many column="ApplicationUserOid" class="BeWo.Data.Entities.ApplicationUser, BeWo.Data" />
|
||||
<many-to-many column="EmployeeOid" class="BeWo.Data.Entities.Employee, BeWo.Data" />
|
||||
</bag>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
CREATE TABLE `AiPromptbaustein` (
|
||||
`Oid` bigint NOT NULL AUTO_INCREMENT,
|
||||
`Tid` int DEFAULT NULL,
|
||||
`IsActive` tinyint(1) DEFAULT NULL,
|
||||
`Notice` varchar(1024) DEFAULT NULL,
|
||||
`InsTs` datetime DEFAULT NULL,
|
||||
`InsUser` varchar(256) DEFAULT NULL,
|
||||
`Version` bigint DEFAULT NULL,
|
||||
`UdpUser` varchar(256) DEFAULT NULL,
|
||||
`SystemEntryID` int DEFAULT NULL,
|
||||
`Text` mediumtext,
|
||||
`Position` int DEFAULT NULL,
|
||||
`Name` varchar(256) DEFAULT NULL,
|
||||
`EmployeeOid` bigint DEFAULT NULL,
|
||||
`IsOnlyForEmployee` tinyint(1) DEFAULT NULL,
|
||||
`ParentOid` bigint DEFAULT NULL,
|
||||
`IsParent` tinyint(1) DEFAULT NULL,
|
||||
`IsExpanded` tinyint DEFAULT NULL,
|
||||
PRIMARY KEY (`Oid`),
|
||||
KEY `EMPLOYEE_AIPROMPTBAUSTEIN_FK` (`EmployeeOid`),
|
||||
KEY `FK_AIPROMPTBAUSTEIN2PARENT` (`ParentOid`),
|
||||
CONSTRAINT `FK_EMPLOYEE_AIPROMPT` FOREIGN KEY (`EmployeeOid`) REFERENCES `employee` (`Oid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEIN2PARENT` FOREIGN KEY (`ParentOid`) REFERENCES `AiPromptbaustein` (`Oid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
@@ -1,28 +0,0 @@
|
||||
CREATE TABLE `AiPromptbausteinTree` (
|
||||
`Oid` bigint NOT NULL AUTO_INCREMENT,
|
||||
`InsTs` datetime DEFAULT NULL,
|
||||
`InsUser` varchar(256) DEFAULT NULL,
|
||||
`Notice` varchar(1024) DEFAULT NULL,
|
||||
`Tid` int DEFAULT NULL,
|
||||
`UdpUser` varchar(256) DEFAULT NULL,
|
||||
`Version` bigint DEFAULT NULL,
|
||||
`IsActive` tinyint DEFAULT NULL,
|
||||
`SystemEntryID` int DEFAULT NULL,
|
||||
`Displayname` varchar(255),
|
||||
`Content` mediumtext,
|
||||
`PromptbausteinType` int,
|
||||
`Metadata` varchar(255),
|
||||
`AiActionType` int,
|
||||
`CreatorOid` bigint DEFAULT NULL,
|
||||
`IsOnlyForCreator` tinyint,
|
||||
`ShowUserPrompt` tinyint,
|
||||
`ShowUserPromptByTenant` tinyint,
|
||||
`Position` int,
|
||||
`IsExpanded` tinyint,
|
||||
`ParentOid` bigint DEFAULT NULL,
|
||||
PRIMARY KEY (`Oid`),
|
||||
KEY `FK_AIPROMPTBAUSTEINTREE_EMPLOYEE_IDX` (`CreatorOid`),
|
||||
KEY `FK_AIPROMPTBAUSTEINTREE_PARENT_IDX` (`ParentOid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEINTREE_EMPLOYEE` FOREIGN KEY (`CreatorOid`) REFERENCES `employee` (`Oid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEINTREE_PARENT` FOREIGN KEY (`ParentOid`) REFERENCES `aipromptbausteintree` (`Oid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
14
Model/Changes_2026-02-10 AI Promptbausteinfolder 4.txt
Normal file
14
Model/Changes_2026-02-10 AI Promptbausteinfolder 4.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
INSERT INTO `.executedscripts`
|
||||
VALUES ('Changes_2026-02-10 AI Promptbausteinfolder 4', '2026-02-10');
|
||||
|
||||
-- wird nicht benötigt
|
||||
DROP TABLE `AiPromptbausteinTree`;
|
||||
DROP TABLE `AiPromptbaustein`;
|
||||
|
||||
-- wird neu erstellt, nicht schlimm, wenns die nicht gibt
|
||||
DROP TABLE `aipromptbausteinprompt2userfavorite`;
|
||||
DROP TABLE `aipromptbausteinprompt2userhide`;
|
||||
DROP TABLE `aipromptbausteinfolder2userhide`;
|
||||
DROP TABLE `aipromptbausteinfolder2usershare`;
|
||||
DROP TABLE `AiPromptbausteinPrompt`;
|
||||
DROP TABLE `AiPromptbausteinFolder`;
|
||||
98
Model/Changes_2026-02-10 AI Promptbausteinfolder finale.txt
Normal file
98
Model/Changes_2026-02-10 AI Promptbausteinfolder finale.txt
Normal file
@@ -0,0 +1,98 @@
|
||||
-- nur ausführen, wenn noch nicht vorhanden
|
||||
CREATE TABLE `.executedscripts` (
|
||||
`Name` varchar(255) UNIQUE,
|
||||
`Datum` DATE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
|
||||
INSERT INTO `.executedscripts`
|
||||
VALUES ('Changes_2026-02-10 AI Promptbausteinfolder finale', CURDATE());
|
||||
|
||||
-- Folder
|
||||
CREATE TABLE `AiPromptbausteinFolder` (
|
||||
`Oid` bigint NOT NULL AUTO_INCREMENT,
|
||||
`InsTs` datetime DEFAULT NULL,
|
||||
`InsUser` varchar(256) DEFAULT NULL,
|
||||
`Notice` varchar(1024) DEFAULT NULL,
|
||||
`Tid` int DEFAULT NULL,
|
||||
`UdpUser` varchar(256) DEFAULT NULL,
|
||||
`Version` bigint DEFAULT NULL,
|
||||
`IsActive` tinyint DEFAULT NULL,
|
||||
`SystemEntryID` int DEFAULT NULL,
|
||||
`Title` varchar(255),
|
||||
`Description` mediumtext,
|
||||
`ParentFolderOid` bigint DEFAULT NULL,
|
||||
`CreatorOid` bigint DEFAULT NULL,
|
||||
`IsPublic` tinyint,
|
||||
`Position` int,
|
||||
`ActionType` int,
|
||||
PRIMARY KEY (`Oid`),
|
||||
KEY `FK_AIPROMPTBAUSTEINFOLDER_EMPLOYEE_IDX` (`CreatorOid`),
|
||||
KEY `FK_AIPROMPTBAUSTEINFOLDER_PARENT_IDX` (`ParentFolderOid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEINFOLDER_EMPLOYEE` FOREIGN KEY (`CreatorOid`) REFERENCES `employee` (`Oid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEINFOLDER_PARENT` FOREIGN KEY (`ParentFolderOid`) REFERENCES `aipromptbausteinfolder` (`Oid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
|
||||
-- Prompts
|
||||
CREATE TABLE `AiPromptbausteinPrompt` (
|
||||
`Oid` bigint NOT NULL AUTO_INCREMENT,
|
||||
`InsTs` datetime DEFAULT NULL,
|
||||
`InsUser` varchar(256) DEFAULT NULL,
|
||||
`Notice` varchar(1024) DEFAULT NULL,
|
||||
`Tid` int DEFAULT NULL,
|
||||
`UdpUser` varchar(256) DEFAULT NULL,
|
||||
`Version` bigint DEFAULT NULL,
|
||||
`IsActive` tinyint DEFAULT NULL,
|
||||
`SystemEntryID` int DEFAULT NULL,
|
||||
`Title` varchar(255),
|
||||
`Description` mediumtext,
|
||||
`ParentFolderOid` bigint DEFAULT NULL,
|
||||
`CreatorOid` bigint,
|
||||
`IsPublic` tinyint,
|
||||
`Position` int,
|
||||
`Prompt` mediumtext,
|
||||
`ShowPrompt` tinyint,
|
||||
`ShowPromptByTenant` tinyint,
|
||||
`IsOwnsoftPrompt` tinyint,
|
||||
`OwnsoftRefLink` varchar(255),
|
||||
`PromptId` varchar(255),
|
||||
PRIMARY KEY (`Oid`),
|
||||
KEY `FK_AIPROMPTBAUSTEINPROMPT_EMPLOYEE_IDX` (`CreatorOid`),
|
||||
KEY `FK_AIPROMPTBAUSTEINPROMPT_PARENT_IDX` (`ParentFolderOid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEINPROMPT_EMPLOYEE` FOREIGN KEY (`CreatorOid`) REFERENCES `employee` (`Oid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEINPROMPT_PARENT` FOREIGN KEY (`ParentFolderOid`) REFERENCES `aipromptbausteinfolder` (`Oid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
|
||||
-- linking tables
|
||||
CREATE TABLE `aipromptbausteinprompt2empfavorite` (
|
||||
`AiPromptbausteinPromptOid` bigint NOT NULL,
|
||||
`EmployeeOid` bigint NOT NULL,
|
||||
PRIMARY KEY (`AiPromptbausteinPromptOid`,`EmployeeOid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEIN2EMPFAV_AIPROMPT` FOREIGN KEY (`AiPromptbausteinPromptOid`) REFERENCES `aipromptbausteinprompt` (`Oid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEIN2EMPFAV_APPUSER` FOREIGN KEY (`EmployeeOid`) REFERENCES `employee` (`Oid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `aipromptbausteinprompt2emphide` (
|
||||
`AiPromptbausteinPromptOid` bigint NOT NULL,
|
||||
`EmployeeOid` bigint NOT NULL,
|
||||
PRIMARY KEY (`AiPromptbausteinPromptOid`,`EmployeeOid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEIN2EMPHIDE_AIPROMPT` FOREIGN KEY (`AiPromptbausteinPromptOid`) REFERENCES `aipromptbausteinprompt` (`Oid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEIN2EMPHIDE_APPUSER` FOREIGN KEY (`EmployeeOid`) REFERENCES `employee` (`Oid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `aipromptbausteinfolder2emphide` (
|
||||
`AiPromptbausteinFolderOid` bigint NOT NULL,
|
||||
`EmployeeOid` bigint NOT NULL,
|
||||
PRIMARY KEY (`AiPromptbausteinFolderOid`,`EmployeeOid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEIN2EMPHIDE_AIFOLDER` FOREIGN KEY (`AiPromptbausteinFolderOid`) REFERENCES `aipromptbausteinfolder` (`Oid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEIN2EMPHIDE_APPUSER2` FOREIGN KEY (`EmployeeOid`) REFERENCES `employee` (`Oid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `aipromptbausteinfolder2empshare` (
|
||||
`AiPromptbausteinFolderOid` bigint NOT NULL,
|
||||
`EmployeeOid` bigint NOT NULL,
|
||||
PRIMARY KEY (`AiPromptbausteinFolderOid`,`EmployeeOid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEIN2EMPSHARE_AIFOLDER` FOREIGN KEY (`AiPromptbausteinFolderOid`) REFERENCES `aipromptbausteinfolder` (`Oid`),
|
||||
CONSTRAINT `FK_AIPROMPTBAUSTEIN2EMPSHARE_APPUSER` FOREIGN KEY (`EmployeeOid`) REFERENCES `employee` (`Oid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
@@ -13,7 +13,7 @@ namespace BeWo.Service.DCEntityMapper
|
||||
{
|
||||
public class AiPromptbausteinPromptDC_AiPromptbausteinPrompt : BeWoDataContract_BeWoEntityBase<AiPromptbausteinPrompt, AiPromptbausteinPromptDC>
|
||||
{
|
||||
public ApplicationUser CurrentApplicationUser => UserRightHelper.GetLoggedInUserWithOid();
|
||||
public Employee CurrentUser => UserRightHelper.GetLoggedInEmployee();
|
||||
|
||||
public override AiPromptbausteinPromptDC MergeWithDC(AiPromptbausteinPrompt pEntity, AiPromptbausteinPromptDC pDataContract)
|
||||
{
|
||||
@@ -30,7 +30,7 @@ namespace BeWo.Service.DCEntityMapper
|
||||
pDataContract.IsOwnsoftPrompt = pEntity.IsOwnsoftPrompt;
|
||||
pDataContract.OwnsoftRefLink = pEntity.OwnsoftRefLink;
|
||||
pDataContract.PromptId = pEntity.PromptId;
|
||||
pDataContract.IsFavorite = pEntity.UserFavorites.Contains(CurrentApplicationUser);
|
||||
pDataContract.IsFavorite = pEntity.UserFavorites.Contains(CurrentUser);
|
||||
|
||||
if(pEntity.CreatorOid is long oid)
|
||||
pDataContract.Creator = new EmployeeServiceImp().GetActiveCompactEmployeeWithOid(oid);
|
||||
@@ -55,7 +55,7 @@ namespace BeWo.Service.DCEntityMapper
|
||||
pEntity.OwnsoftRefLink = pDataContract.OwnsoftRefLink;
|
||||
pEntity.PromptId = pDataContract.PromptId;
|
||||
|
||||
var user = CurrentApplicationUser;
|
||||
var user = CurrentUser;
|
||||
if (pDataContract.IsFavorite && !pEntity.UserFavorites.Contains(user))
|
||||
{
|
||||
pEntity.UserFavorites.Add(user);
|
||||
|
||||
Reference in New Issue
Block a user