-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[PM-32067] - Add Provider Ability View #7200
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| CREATE PROCEDURE [dbo].[Provider_ReadAbilityById] | ||
| @Id UNIQUEIDENTIFIER | ||
| AS | ||
| BEGIN | ||
| SET NOCOUNT ON | ||
|
|
||
| SELECT | ||
| [Id], | ||
| [UseEvents], | ||
| [Enabled] | ||
| FROM | ||
| [dbo].[ProviderAbilityView] | ||
| WHERE | ||
| [Id] = @Id | ||
| END | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| CREATE VIEW [dbo].[ProviderAbilityView] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. β Is this view necessary? We already have a view called
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was done according to our contributing docs. |
||
| AS | ||
| SELECT | ||
| [Id], | ||
| [UseEvents], | ||
| [Enabled] | ||
| FROM | ||
| [dbo].[Provider] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| ο»Ώusing Bit.Core.AdminConsole.Models.Data.Provider; | ||
| using Xunit; | ||
|
|
||
| using ProviderEntity = Bit.Core.AdminConsole.Entities.Provider.Provider; | ||
|
|
||
| namespace Bit.Core.Test.AdminConsole.Models.Data.Provider; | ||
|
|
||
| public class ProviderAbilityTests | ||
| { | ||
| [Fact] | ||
| public void Constructor_MapsAllProperties() | ||
| { | ||
| var provider = new ProviderEntity | ||
| { | ||
| Id = Guid.NewGuid(), | ||
| UseEvents = true, | ||
| Enabled = true, | ||
| }; | ||
|
|
||
| var ability = new ProviderAbility(provider); | ||
|
|
||
| Assert.Equal(provider.Id, ability.Id); | ||
| Assert.Equal(provider.UseEvents, ability.UseEvents); | ||
| Assert.Equal(provider.Enabled, ability.Enabled); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Constructor_DefaultValues() | ||
| { | ||
| var provider = new ProviderEntity | ||
| { | ||
| Id = Guid.NewGuid(), | ||
| UseEvents = false, | ||
| Enabled = false, | ||
| }; | ||
|
|
||
| var ability = new ProviderAbility(provider); | ||
|
|
||
| Assert.Equal(provider.Id, ability.Id); | ||
| Assert.False(ability.UseEvents); | ||
| Assert.False(ability.Enabled); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| CREATE OR ALTER VIEW [dbo].[ProviderAbilityView] | ||
| AS | ||
| SELECT | ||
| [Id], | ||
| [UseEvents], | ||
| [Enabled] | ||
| FROM | ||
| [dbo].[Provider] | ||
| GO | ||
|
|
||
| CREATE OR ALTER PROCEDURE [dbo].[Provider_ReadAbilityById] | ||
| @Id UNIQUEIDENTIFIER | ||
| AS | ||
| BEGIN | ||
| SET NOCOUNT ON | ||
|
|
||
| SELECT | ||
| [Id], | ||
| [UseEvents], | ||
| [Enabled] | ||
| FROM | ||
| [dbo].[ProviderAbilityView] | ||
| WHERE | ||
| [Id] = @Id | ||
| END | ||
| GO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine but you might want to change it to
SELECT *to match the contributing docs.