mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[AC-2804] Add client ID to provider client invoice report (#4458)
* Add client ID to provider client invoice report * Run dotnet format
This commit is contained in:
@ -0,0 +1,124 @@
|
||||
-- Add 'ClientId' column to 'ProviderInvoiceItem' table.
|
||||
IF COL_LENGTH('[dbo].[ProviderInvoiceItem]', 'ClientId') IS NULL
|
||||
BEGIN
|
||||
ALTER TABLE
|
||||
[dbo].[ProviderInvoiceItem]
|
||||
ADD
|
||||
[ClientId] UNIQUEIDENTIFIER NULL;
|
||||
END
|
||||
GO
|
||||
|
||||
-- Recreate 'ProviderInvoiceItemView' so that it includes the 'ClientId' column.
|
||||
CREATE OR ALTER VIEW [dbo].[ProviderInvoiceItemView]
|
||||
AS
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
[dbo].[ProviderInvoiceItem]
|
||||
GO
|
||||
|
||||
-- Alter 'ProviderInvoiceItem_Create' SPROC to add 'ClientId' column.
|
||||
CREATE OR ALTER PROCEDURE [dbo].[ProviderInvoiceItem_Create]
|
||||
@Id UNIQUEIDENTIFIER OUTPUT,
|
||||
@ProviderId UNIQUEIDENTIFIER,
|
||||
@InvoiceId VARCHAR (50),
|
||||
@InvoiceNumber VARCHAR (50),
|
||||
@ClientName NVARCHAR (50),
|
||||
@PlanName NVARCHAR (50),
|
||||
@AssignedSeats INT,
|
||||
@UsedSeats INT,
|
||||
@Total MONEY,
|
||||
@Created DATETIME2 (7) = NULL,
|
||||
@ClientId UNIQUEIDENTIFIER = NULL
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
SET @Created = COALESCE(@Created, GETUTCDATE())
|
||||
|
||||
INSERT INTO [dbo].[ProviderInvoiceItem]
|
||||
(
|
||||
[Id],
|
||||
[ProviderId],
|
||||
[InvoiceId],
|
||||
[InvoiceNumber],
|
||||
[ClientName],
|
||||
[PlanName],
|
||||
[AssignedSeats],
|
||||
[UsedSeats],
|
||||
[Total],
|
||||
[Created],
|
||||
[ClientId]
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@Id,
|
||||
@ProviderId,
|
||||
@InvoiceId,
|
||||
@InvoiceNumber,
|
||||
@ClientName,
|
||||
@PlanName,
|
||||
@AssignedSeats,
|
||||
@UsedSeats,
|
||||
@Total,
|
||||
@Created,
|
||||
@ClientId
|
||||
)
|
||||
END
|
||||
GO
|
||||
|
||||
-- Alter 'ProviderInvoiceItem_Update' SPROC to add 'ClientId' column.
|
||||
CREATE OR ALTER PROCEDURE [dbo].[ProviderInvoiceItem_Update]
|
||||
@Id UNIQUEIDENTIFIER,
|
||||
@ProviderId UNIQUEIDENTIFIER,
|
||||
@InvoiceId VARCHAR (50),
|
||||
@InvoiceNumber VARCHAR (50),
|
||||
@ClientName NVARCHAR (50),
|
||||
@PlanName NVARCHAR (50),
|
||||
@AssignedSeats INT,
|
||||
@UsedSeats INT,
|
||||
@Total MONEY,
|
||||
@Created DATETIME2 (7) = NULL,
|
||||
@ClientId UNIQUEIDENTIFIER = NULL
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
SET @Created = COALESCE(@Created, GETUTCDATE())
|
||||
|
||||
UPDATE
|
||||
[dbo].[ProviderInvoiceItem]
|
||||
SET
|
||||
[ProviderId] = @ProviderId,
|
||||
[InvoiceId] = @InvoiceId,
|
||||
[InvoiceNumber] = @InvoiceNumber,
|
||||
[ClientName] = @ClientName,
|
||||
[PlanName] = @PlanName,
|
||||
[AssignedSeats] = @AssignedSeats,
|
||||
[UsedSeats] = @UsedSeats,
|
||||
[Total] = @Total,
|
||||
[Created] = @Created,
|
||||
[ClientId] = @ClientId
|
||||
WHERE
|
||||
[Id] = @Id
|
||||
END
|
||||
GO
|
||||
|
||||
-- Refresh modules for SPROCs reliant on 'ProviderInvoiceItem' table/view.
|
||||
IF OBJECT_ID('[dbo].[ProviderInvoiceItem_ReadById]') IS NOT NULL
|
||||
BEGIN
|
||||
EXECUTE sp_refreshsqlmodule N'[dbo].[ProviderInvoiceItem_ReadById]';
|
||||
END
|
||||
GO
|
||||
|
||||
IF OBJECT_ID('[dbo].[ProviderInvoiceItem_ReadByInvoiceId]') IS NOT NULL
|
||||
BEGIN
|
||||
EXECUTE sp_refreshsqlmodule N'[dbo].[ProviderInvoiceItem_ReadByInvoiceId]';
|
||||
END
|
||||
GO
|
||||
|
||||
IF OBJECT_ID('[dbo].[ProviderInvoiceItem_ReadByProviderId]') IS NOT NULL
|
||||
BEGIN
|
||||
EXECUTE sp_refreshsqlmodule N'[dbo].[ProviderInvoiceItem_ReadByProviderId]';
|
||||
END
|
||||
GO
|
2674
util/MySqlMigrations/Migrations/20240703182722_AddClientIdToProviderInvoiceItem.Designer.cs
generated
Normal file
2674
util/MySqlMigrations/Migrations/20240703182722_AddClientIdToProviderInvoiceItem.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.MySqlMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class AddClientIdToProviderInvoiceItem : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ClientId",
|
||||
table: "ProviderInvoiceItem",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ClientId",
|
||||
table: "ProviderInvoiceItem");
|
||||
}
|
||||
}
|
@ -693,6 +693,9 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.Property<int>("AssignedSeats")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid?>("ClientId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("ClientName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
|
2681
util/PostgresMigrations/Migrations/20240703182718_AddClientIdToProviderInvoiceItem.Designer.cs
generated
Normal file
2681
util/PostgresMigrations/Migrations/20240703182718_AddClientIdToProviderInvoiceItem.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,27 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.PostgresMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class AddClientIdToProviderInvoiceItem : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ClientId",
|
||||
table: "ProviderInvoiceItem",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ClientId",
|
||||
table: "ProviderInvoiceItem");
|
||||
}
|
||||
}
|
@ -698,6 +698,9 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
b.Property<int>("AssignedSeats")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid?>("ClientId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ClientName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
|
2663
util/SqliteMigrations/Migrations/20240703182714_AddClientIdToProviderInvoiceItem.Designer.cs
generated
Normal file
2663
util/SqliteMigrations/Migrations/20240703182714_AddClientIdToProviderInvoiceItem.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,27 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.SqliteMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class AddClientIdToProviderInvoiceItem : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ClientId",
|
||||
table: "ProviderInvoiceItem",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ClientId",
|
||||
table: "ProviderInvoiceItem");
|
||||
}
|
||||
}
|
@ -682,6 +682,9 @@ namespace Bit.SqliteMigrations.Migrations
|
||||
b.Property<int>("AssignedSeats")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<Guid?>("ClientId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ClientName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
|
Reference in New Issue
Block a user