-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Initial PoC of seeder API #6424
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
Draft
Hinton
wants to merge
44
commits into
main
Choose a base branch
from
arch/seeder-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
418dbb3
SDK integration in db seeder
Hinton 072f9f2
Add hash password
Hinton 75f11f6
Generate valid keys using rust
Hinton 3132e09
Wire up crypto logic for sharing org key
Hinton 3ad3081
Speed up KDF
Hinton 9900a74
Use pre-generated RSA key
Hinton fa46919
Initial PoC of seeder API
Hinton d0d6bfb
Extract logic into service
Hinton 2b340b7
Reformat
Hinton 79f5d8f
Add support for destroying seeded data
Hinton 92f2555
Refactor to track entities rather than manually writing destroy
Hinton 185fbd0
Merge branch 'main' of github.com:bitwarden/server into arch/seeder-sdk
Hinton 12ad758
Add dedicated functions instead of updating existing
Hinton 4192b08
Configure csproj to build rust
Hinton f4342e2
Add SingleUserRecipe for seeding a single known user
MGibson1 d93cd50
Fix launch settings
MGibson1 5784d74
Add workaround for generated code
Hinton 9a9c991
Undo changes to program.cs
Hinton fdd7cd0
Change the paths to wildcard to avoid errors on other platforms
Hinton 431a708
Delete all seeded data
MGibson1 44aef68
Merge branch 'arch/seeder-sdk' of github.com:bitwarden/server into arโฆ
Hinton 3d863c0
Fixup device table user FK cascade
MGibson1 9c4c88f
Wire up SDK
Hinton 13d666a
Fixup user mangling
MGibson1 ec82894
Prefer Repositories for Delete of entities
MGibson1 a7340c9
Add delete batch for playwright worker cleanup
MGibson1 fac2804
Force ef
Hinton 99fb70a
use named parameters
MGibson1 45ba8f8
Add support for setting email verified and premium in seed
Hinton 1137857
Add recipe for getting emergency access invites
Hinton 6be734b
Get rid of some newlines
Hinton 638a6be
Update SDK
Hinton 7135fb1
Merge branch 'main' of github.com:bitwarden/server into arch/seeder-sdk
Hinton 39cdb65
Add cargo as enabled manager in renovate
Hinton bb226ff
Delete Sdk2
Hinton 91badfb
Remove Sdk2
Hinton 685ee37
Add cargo to renovate
Hinton 58c620e
Merge branch 'arch/seeder-sdk' of github.com:bitwarden/server into arโฆ
Hinton b9dcac4
Initial cleanup
Hinton f6fe7a9
Change to primary constructor
Hinton fd41332
Refactor recipies into scenes
Hinton 1daf9ad
Add queries, rename seed to scene
Hinton 9231ae3
Split Scene and Query
Hinton 16ee5cf
Merge branch 'main' of github.com:bitwarden/server into arch/seeder-api
Hinton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| namespace Bit.Infrastructure.EntityFramework.Models; | ||
|
|
||
| public class SeededData | ||
| { | ||
| public Guid Id { get; set; } | ||
| public required string RecipeName { get; set; } | ||
| /// <summary> | ||
| /// JSON blob containing all | ||
| /// </summary> | ||
| public required string Data { get; set; } | ||
| public DateTime CreationDate { get; set; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| CREATE TABLE [dbo].[SeededData] ( | ||
| [Id] UNIQUEIDENTIFIER NOT NULL, | ||
| [RecipeName] NVARCHAR (MAX) NOT NULL, | ||
| [Data] NVARCHAR (MAX) NULL, | ||
| [CreationDate] DATETIME2 (7) NOT NULL, | ||
| ); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@MGibson1 did we want to revert this?
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.
That was undecided. I believe we don't need it anymore with the full repository injection we're using, but it's not wrong.
@rkac-bw @withinfocus Care to comment on using cascading delete here vs needing to understand delete through sprocs?
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.
I am not a fan of cascades personally and try to avoid them, but they were here when I showed up so I am working with it. Our approach -- and this could use documentation on our revamped SQL code style page -- is to manage deletions that touch critical tables explicitly e.g. Organization_DeleteById, and for smaller children of those tables to allow cascades so as to keep the coding pattern simple enough.
One example:
OrganizationIntegration, being linked to the criticalOrganizationtable, is deleted via the above proc. Its child tableOrganizationIntegrationConfigurationhas a cascade delete on it.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.
The delete is already handled through the sproc, what problem are we trying to solve here?