Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sandbox/add missing build files #149

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
CREATE TABLE [dbo].[FoundationConfiguration]
(
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[AppName] NVARCHAR(250) NOT NULL,
[IsInstalled] BIT NOT NULL DEFAULT(0),
CONSTRAINT [PK_FoundationConfiguration] PRIMARY KEY CLUSTERED ([Id] ASC)
);
GO

CREATE PROCEDURE [dbo].[FoundationConfiguration_List]
AS
BEGIN
SELECT * FROM FoundationConfiguration
END
GO

CREATE PROCEDURE [dbo].[FoundationConfiguration_SetInstalled]
AS
BEGIN
UPDATE FoundationConfiguration SET IsInstalled = 1
END
GO

CREATE PROCEDURE [dbo].[FoundationConfiguration_Save]
(
@Id INT = 0,
@AppName NVARCHAR(250),
@IsInstalled BIT = 0
)
AS
BEGIN
IF @Id > 0
UPDATE FoundationConfiguration SET AppName = @AppName, IsInstalled = @IsInstalled WHERE Id = @Id
ELSE
INSERT INTO FoundationConfiguration (AppName, IsInstalled) VALUES (@AppName, @IsInstalled)

END
GO

INSERT INTO FoundationConfiguration (AppName) VALUES ( '$(appname)')
GO
38 changes: 38 additions & 0 deletions sandbox/Foundation/Build/SqlScripts/ServiceApiCms.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
--beginvalidatingquery
IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'tblUserPermission')
BEGIN
IF NOT EXISTS (SELECT pkid FROM dbo.tblUserPermission WHERE Permission = 'WriteAccess' and GroupName = 'EPiServerServiceApi')
SELECT 1, 'Installing Permissions'
ELSE
SELECT 0, 'Already installed default permissions'
END
ELSE
select -1, 'Not an EPiServer CMS database'
--endvalidatingquery

GO

INSERT INTO [dbo].[tblUserPermission]
([Name]
,[IsRole]
,[Permission]
,[GroupName])
VALUES
('Administrators'
,1
,'WriteAccess'
,'EPiServerServiceApi')
GO

INSERT INTO [dbo].[tblUserPermission]
([Name]
,[IsRole]
,[Permission]
,[GroupName])
VALUES
('Administrators'
,1
,'ReadAccess'
,'EPiServerServiceApi')

GO
37 changes: 37 additions & 0 deletions sandbox/Foundation/Build/SqlScripts/ServiceApiCommerce.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
--beginvalidatingquery
IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'SchemaVersion')
BEGIN
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id (N'[dbo].[ecf_CatalogEntry_Paging]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
select 0,'Already correct database version'
ELSE
select 1, 'Upgrading database'
END
ELSE
select -1, 'Not an EPiServer Commerce database'
go
--endvalidatingquery

-- ecf_CatalogEntry_Paging.sql
CREATE PROCEDURE [dbo].[ecf_CatalogEntry_Paging]
@StartPage int,
@PageSize int,
@ReturnInactive bit = 0
AS
BEGIN
DECLARE @intStartRow int;
DECLARE @intEndRow int;

SET @intStartRow = (@StartPage -1) * @PageSize + 1;
SET @intEndRow = @StartPage * @PageSize;

WITH entries AS
(SELECT CatalogEntryId,
ROW_NUMBER() OVER(ORDER BY CatalogEntryId) as intRow,
COUNT(CatalogEntryId) OVER() AS intTotalHits
FROM CatalogEntry)

SELECT CatalogEntryId, intTotalHits FROM entries
WHERE intRow BETWEEN @intStartRow AND @intEndRow
END
go
-- END OF ecf_CatalogEntry_Paging.sql
116 changes: 116 additions & 0 deletions sandbox/Foundation/Build/SqlScripts/UniqueCouponSchema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
CREATE TABLE [dbo].[UniqueCoupons]
(
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[PromotionId] [int] NOT NULL,
[Code] [nvarchar](max) NOT NULL,
[Valid] [datetime2](7) NOT NULL,
[Expiration] [datetime2](7) NULL,
[CustomerId] [uniqueidentifier] NULL,
[Created] [datetime2](7) NULL,
[MaxRedemptions] [int] NULL,
[UsedRedemptions] [int] NULL,
CONSTRAINT [PK_UniqueCoupons] PRIMARY KEY CLUSTERED ([Id] ASC)
);
GO

CREATE NONCLUSTERED INDEX [IDX_UniqueCoupons_PromotionId] ON [dbo].[UniqueCoupons]
(
[PromotionId] ASC
)
GO

CREATE TYPE [dbo].[udttUniqueCoupons] AS TABLE
(
[Id] [bigint] NOT NULL,
[PromotionId] [int] NOT NULL,
[Code] [nvarchar](max) NOT NULL,
[Valid] [datetime2](7) NOT NULL,
[Expiration] [datetime2](7) NULL,
[CustomerId] [uniqueidentifier] NULL,
[Created] [datetime2](7) NOT NULL,
[MaxRedemptions] [int] NOT NULL,
[UsedRedemptions] [int] NOT NULL
);
GO

CREATE PROCEDURE [dbo].[UniqueCoupons_DeleteById]
(
@Id BIGINT
)
AS
BEGIN
DELETE FROM UniqueCoupons
WHERE Id = @Id
END
GO

CREATE PROCEDURE [dbo].[UniqueCoupons_DeleteByPromotionId]
(
@PromotionId INT
)
AS
BEGIN
DELETE FROM UniqueCoupons
WHERE PromotionId = @PromotionId
END
GO

CREATE PROCEDURE [dbo].[UniqueCoupons_GetById]
(
@Id BIGINT
)
AS
BEGIN
SELECT * FROM UniqueCoupons
WHERE Id = @Id
END
GO

CREATE PROCEDURE [dbo].[UniqueCoupons_GetByPromotionId]
(
@PromotionId INT
)
AS
BEGIN
SELECT * FROM UniqueCoupons
WHERE PromotionId = @PromotionId
END
GO

CREATE PROCEDURE [dbo].[UniqueCoupons_Save]
(
@Data dbo.[udttUniqueCoupons] readonly
)
AS
BEGIN
MERGE dbo.UniqueCoupons AS TARGET
USING @Data AS SOURCE
On (TARGET.Id = SOURCE.Id)
WHEN MATCHED THEN
UPDATE SET PromotionId = SOURCE.PromotionId,
Code = SOURCE.Code,
Valid = SOURCE.Valid,
Expiration = SOURCE.Expiration,
CustomerId = SOURCE.CustomerId,
Created = SOURCE.Created,
MaxRedemptions = SOURCE.MaxRedemptions,
UsedRedemptions = SOURCE.UsedRedemptions

WHEN NOT MATCHED THEN
INSERT (PromotionId, Code, Valid, Expiration, CustomerId, Created, MaxRedemptions, UsedRedemptions)
VALUES (SOURCE.PromotionId, SOURCE.Code, SOURCE.Valid, SOURCE.Expiration, SOURCE.CustomerId, SOURCE.Created, SOURCE.MaxRedemptions, SOURCE.UsedRedemptions);
END
GO


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO

Create PROCEDURE [dbo].[UniqueCoupons_DeleteExpiredCoupons]
AS
BEGIN
DELETE FROM UniqueCoupons
WHERE Expiration < GETDATE()
END
14 changes: 14 additions & 0 deletions sandbox/Foundation/Build/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"EPiServer.Commerce": "Debug"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"EPiServerDB": "Data Source=.;Database=netcore.qs.Cms;User Id=netcoreUser;Password=epi#Server7Local;MultipleActiveResultSets=True"
}
}
Binary file added sandbox/Foundation/Build/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sandbox/Foundation/Build/nuget.exe
Binary file not shown.
1 change: 1 addition & 0 deletions sandbox/Foundation/Build/version.props
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1
Binary file added sandbox/Foundation/Build/vswhere.exe
Binary file not shown.
Loading
Loading