Skip to content

Commit

Permalink
Merge pull request #67 from TunNetCom/ModifyDatabase
Browse files Browse the repository at this point in the history
Modify Database
  • Loading branch information
MarwenSaad authored Sep 20, 2024
2 parents bbfc455 + ded21d7 commit ceb336c
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public async Task<OneOf<WiqlResponses, WiqlBadRequestResponce>> GetWorkItemByUse
return new WiqlBadRequestResponce()
{
Email = resource.Email,
ErrorCode = (int?)workItemResponse.StatusCode,
ErrorCode = (int)workItemResponse.StatusCode,
Message = AzureResponseMessage.WorkItemError,
Path = resource.Path,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public async Task Handle(ProfileUserCommand request, CancellationToken cancellat
OneOf<UserProfile, CustomProblemDetailsResponce> adminInfoResponse = await _userProfileApiClient.GetAdminInfo(request.BaseRequest);
if (adminInfoResponse.IsT0)
{

OneOf<UserAccount, CustomProblemDetailsResponce> organizationResponce = await _userProfileApiClient.GeUserOrganizations(
new GetUserOrganizationRequest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
<Build Include="dbo\Tables\User.sql" />
<Build Include="dbo\Tables\AionTimeSubscription.sql" />
<Build Include="dbo\Tables\AionTimeSubscriptionHistory.sql" />
<Build Include="dbo\Tables\UserPath.sql" />
<Build Include="dbo\Tables\UserPathOrganizations.sql" />
</ItemGroup>
<ItemGroup>
<None Include="TimeLogService.Database.publish.xml" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
CREATE TABLE [dbo].[Organization]
(
[Id] INT IDENTITY (1, 1) PRIMARY KEY NOT NULL,
[UserId] NVARCHAR(100) not null,
[Name] Varchar(255) not null,
[AccountId] NVARCHAR(100) NOT NULL unique,
[AccountUri] VARCHAR(200) NOT NULL,
[IsAionTimeApproved] BIT NOT NULL

CONSTRAINT FKUserOrganization
FOREIGN KEY (UserId)
REFERENCES [dbo].[User] (UserId)
ON DELETE CASCADE
ON UPDATE CASCADE,
[IsAionTimeApproved] BIT NOT NULL,
[CreationDate] datetime not null
)

GO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
CREATE TABLE [dbo].[User]
(
[Id] INT IDENTITY (1, 1) PRIMARY KEY NOT NULL,
[UserId] NVARCHAR(100) NOT NULL UNIQUE,
[EmailAddress] VARCHAR(50) NOT NULL,
[PublicAlias] NVARCHAR(100) NOT NULL,
[CoreRevision] INT NOT NULL,
[TimeStamp] DATETIME NOT NULL,
[Revision] INT NOT NULL
[EmailAddress] VARCHAR(50) NOT NULL UNIQUE,
)
12 changes: 12 additions & 0 deletions src/TimeLogService/TimeLogService.DataBase/dbo/Tables/UserPath.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CREATE TABLE [dbo].[UserPath]
(
[Id] INT NOT NULL PRIMARY KEY,
[UserId] INT NOT NULL,
[PathType] NVARCHAR(150) NOT NULL,

CONSTRAINT FK_UserPath_Uesr
FOREIGN KEY (UserId)
REFERENCES [dbo].[User] (Id)
ON DELETE CASCADE
ON UPDATE CASCADE
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE [dbo].[UserPathOrganizations] (
[PathId] INT NOT NULL,
[OrganizationId] INT NOT NULL,
[CreationDate] DATETIME
PRIMARY KEY ([PathId], [OrganizationId]) NOT NULL,
FOREIGN KEY ([PathId]) REFERENCES [dbo].[UserPath]([Id]),
FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization]([Id])
);

0 comments on commit ceb336c

Please sign in to comment.