Skip to content

Commit f1adbab

Browse files
committed
clean up and docker stuff + python test suite for OASIS api + seed script
1 parent 572c684 commit f1adbab

1,208 files changed

Lines changed: 4333 additions & 24050 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.DS_Store

-18 KB
Binary file not shown.

.dockerignore

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,18 @@ Logos/
1515
**/publish/
1616

1717
# IDE files
18-
.vs/
19-
.vscode/
20-
*.user
21-
*.suo
22-
*.userosscache
23-
*.sln.docstates
24-
25-
# Test files
26-
**/TestHarness/
27-
**/UnitTests/
28-
**/IntegrationTests/
29-
**/TestResults/
30-
31-
# Logs
32-
*.log
33-
build.log
34-
build_errors.txt
35-
36-
# Archives
37-
*.zip
38-
*.rar
39-
*.7z
40-
41-
# Node modules (if any)
42-
node_modules/
43-
npm-debug.log*
18+
**/.vs/
19+
**/.vscode/
4420

45-
# Temporary files
46-
*.tmp
47-
*.temp
48-
.DS_Store
49-
Thumbs.db
21+
# Node modules
22+
**/node_modules/
23+
**/npm-debug.log*
5024

5125
# Large directories that aren't needed for build
5226
Archived/
53-
External Libs/
27+
# External Libs/ # Needed for build now
5428
lumina-j5-bootstrap/
29+
_CLEANUP_ARCHIVE/
5530

5631
# Package files
5732
*.nupkg

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,10 @@ NextGenSoftware.OASIS.API.ONODE.WebUI.HTML/react-app/yarn.lock
276276
/STAR ODK/OAPPTemplates/Source/final/OAPPTemplateDNA.json
277277
/STAR ODK/OAPPTemplates/Source/super
278278
/STAR ODK/OAPPTemplates
279-
/STAR ODK
280-
/STAR ODK/Runtimes
281-
/STAR ODK/Runtimes/OASIS Runtime
282-
/STAR ODK/Runtimes/STAR Runtime
279+
#/STAR ODK
280+
#/STAR ODK/Runtimes
281+
#/STAR ODK/Runtimes/OASIS Runtime
282+
#/STAR ODK/Runtimes/STAR Runtime
283283
/STAR ODK/STAR OAPP DNA Templates
284284
/STAR ODK/STAR OAPP DNA Templates/hello world!
285285
/STAR ODK/STAR OAPP DNA Templates/NextGenSoftware.OASIS.STAR.DNATemplates.OAPP.Base

Dockerfile

Lines changed: 0 additions & 39 deletions
This file was deleted.

Dockerfile.star-api

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 3c4726d70ed96303f8f4263873181cdde0d5d96d

OASIS Architecture/NextGenSoftware.OASIS.API.Core/Enums/AvatarType.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ public enum AvatarType
44
{
55
Wizard,
66
User,
7-
System
7+
System,
8+
Admin
89
}
910
}

OASIS Architecture/NextGenSoftware.OASIS.API.Core/Managers/AvatarManager/AvatarManager-Private.cs

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -205,76 +205,6 @@ private OASISResult<IAvatarDetail> PrepareToRegisterAvatarDetail(Guid avatarId,
205205
CreatedByAvatarId = avatarId
206206
};
207207

208-
// TODO: Temp! Remove later!
209-
if (email == "davidellams@hotmail.com")
210-
{
211-
avatarDetail.Karma = 777777;
212-
avatarDetail.XP = 2222222;
213-
214-
avatarDetail.GeneKeys.Add(new GeneKey() { Name = "Expectation", Gift = "a gift", Shadow = "a shadow", Sidhi = "a sidhi" });
215-
avatarDetail.GeneKeys.Add(new GeneKey() { Name = "Invisibility", Gift = "a gift", Shadow = "a shadow", Sidhi = "a sidhi" });
216-
avatarDetail.GeneKeys.Add(new GeneKey() { Name = "Rapture", Gift = "a gift", Shadow = "a shadow", Sidhi = "a sidhi" });
217-
218-
avatarDetail.HumanDesign.Type = "Generator";
219-
//avatarDetail.Inventory.Add(new InventoryItem() { Name = "Magical Armour" });
220-
//avatarDetail.Inventory.Add(new InventoryItem() { Name = "Mighty Wizard Sword" });
221-
222-
avatarDetail.Spells.Add(new Spell() { Name = "Super Spell" });
223-
avatarDetail.Spells.Add(new Spell() { Name = "Super Speed Spell" });
224-
avatarDetail.Spells.Add(new Spell() { Name = "Super Srength Spell" });
225-
226-
avatarDetail.Achievements.Add(new Achievement() { Name = "Becoming Superman!" });
227-
avatarDetail.Achievements.Add(new Achievement() { Name = "Completing STAR!" });
228-
229-
avatarDetail.Gifts.Add(new AvatarGift() { GiftType = KarmaTypePositive.BeASuperHero });
230-
231-
avatarDetail.Aura.Brightness = 99;
232-
avatarDetail.Aura.Level = 77;
233-
avatarDetail.Aura.Progress = 88;
234-
avatarDetail.Aura.Size = 10;
235-
avatarDetail.Aura.Value = 777;
236-
237-
avatarDetail.Chakras.Root.Level = 77;
238-
avatarDetail.Chakras.Root.Progress = 99;
239-
avatarDetail.Chakras.Root.XP = 8783;
240-
241-
avatarDetail.Attributes.Dexterity = 99;
242-
avatarDetail.Attributes.Endurance = 99;
243-
avatarDetail.Attributes.Intelligence = 99;
244-
avatarDetail.Attributes.Magic = 99;
245-
avatarDetail.Attributes.Speed = 99;
246-
avatarDetail.Attributes.Strength = 99;
247-
avatarDetail.Attributes.Toughness = 99;
248-
avatarDetail.Attributes.Vitality = 99;
249-
avatarDetail.Attributes.Wisdom = 99;
250-
251-
avatarDetail.Stats.Energy.Current = 99;
252-
avatarDetail.Stats.Energy.Max = 99;
253-
avatarDetail.Stats.HP.Current = 99;
254-
avatarDetail.Stats.HP.Max = 99;
255-
avatarDetail.Stats.Mana.Current = 99;
256-
avatarDetail.Stats.Mana.Max = 99;
257-
avatarDetail.Stats.Stamina.Current = 99;
258-
avatarDetail.Stats.Stamina.Max = 99;
259-
260-
avatarDetail.SuperPowers.AstralProjection = 99;
261-
avatarDetail.SuperPowers.BioLocatation = 88;
262-
avatarDetail.SuperPowers.Flight = 99;
263-
avatarDetail.SuperPowers.FreezeBreath = 88;
264-
avatarDetail.SuperPowers.HeatVision = 99;
265-
avatarDetail.SuperPowers.Invulnerability = 99;
266-
avatarDetail.SuperPowers.SuperSpeed = 99;
267-
avatarDetail.SuperPowers.SuperStrength = 99;
268-
avatarDetail.SuperPowers.XRayVision = 99;
269-
avatarDetail.SuperPowers.Teleportation = 99;
270-
avatarDetail.SuperPowers.Telekinesis = 99;
271-
272-
avatarDetail.Skills.Computers = 99;
273-
avatarDetail.Skills.Engineering = 99;
274-
}
275-
276-
//avatarDetail.CreatedDate = DateTime.UtcNow;
277-
278208
result.Result = avatarDetail;
279209
return result;
280210
}

OASIS Architecture/NextGenSoftware.OASIS.API.Core/Managers/AvatarManager/AvatarManager.cs

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,81 @@ public async Task<OASISResult<IAvatar>> RegisterAsync(string avatarTitle, string
366366
return result;
367367
}
368368

369+
public async Task<OASISResult<IAvatar>> RegisterAdminAsync(string adminFirstName, string adminLastName, string adminEmail, string adminUsername, string adminPassword, OASISType createdOASISType = OASISType.OASISBootLoader, ConsoleColor cliColour = ConsoleColor.Red, ConsoleColor favColour = ConsoleColor.Red, string avatarTitle = "Admin", AvatarType avatarType = AvatarType.Admin)
370+
{
371+
OASISResult<IAvatar> result = new OASISResult<IAvatar>();
372+
373+
try
374+
{
375+
// First try by username...
376+
result = await LoadAvatarAsync(adminUsername, false, false);
377+
378+
if (result.Result == null)
379+
{
380+
// Now try by email...
381+
result = await LoadAvatarByEmailAsync(adminEmail, false, false);
382+
}
383+
384+
if (result.Result != null)
385+
{
386+
result.Message = "Avatar already exists.";
387+
result.IsError = false;
388+
return result;
389+
}
390+
391+
result = await PrepareToRegisterAvatarAsync(avatarTitle, adminFirstName, adminLastName, adminEmail, adminPassword, adminUsername, avatarType, createdOASISType);
392+
393+
if (result != null && !result.IsError && result.Result != null)
394+
{
395+
// Manually verify and activate the admin account immediately
396+
result.Result.Verified = DateTime.Now;
397+
result.Result.IsActive = true;
398+
result.Result.VerificationToken = null; // Clear token as it's already verified
399+
400+
// AvatarDetail needs to have the same unique ID as Avatar so the records match (they will have unique/different provider keys per each provider)
401+
OASISResult<IAvatarDetail> avatarDetailResult = PrepareToRegisterAvatarDetail(result.Result.Id, result.Result.Username, result.Result.Email, createdOASISType, cliColour, favColour);
402+
403+
if (avatarDetailResult != null && !avatarDetailResult.IsError && avatarDetailResult.Result != null)
404+
{
405+
OASISResult<IAvatar> saveAvatarResult = await SaveAvatarAsync(result.Result);
406+
407+
if (!saveAvatarResult.IsError && saveAvatarResult.IsSaved)
408+
{
409+
result.Result = saveAvatarResult.Result;
410+
OASISResult<IAvatarDetail> saveAvatarDetailResult = await SaveAvatarDetailAsync(avatarDetailResult.Result);
411+
412+
if (saveAvatarDetailResult != null && !saveAvatarDetailResult.IsError && saveAvatarDetailResult.Result != null)
413+
{
414+
// result = AvatarRegistered(result); // Don't call this as it sends verification email!
415+
result.Result = HideAuthDetails(result.Result);
416+
result.IsSaved = true;
417+
result.Message = "Admin Account Created Successfully.";
418+
}
419+
else
420+
{
421+
result.Message = saveAvatarDetailResult.Message;
422+
result.IsError = saveAvatarDetailResult.IsError;
423+
result.IsSaved = saveAvatarDetailResult.IsSaved;
424+
}
425+
}
426+
else
427+
{
428+
result.Message = saveAvatarResult.Message;
429+
result.IsError = saveAvatarResult.IsError;
430+
result.IsSaved = saveAvatarResult.IsSaved;
431+
}
432+
}
433+
}
434+
}
435+
catch (Exception ex)
436+
{
437+
OASISErrorHandling.HandleError(ref result, string.Concat("Unknown error occured in RegisterAdminAsync method in AvatarManager. Error Message: ", ex.Message), ex);
438+
result.Result = null;
439+
}
440+
441+
return result;
442+
}
443+
369444
public OASISResult<IAvatar> BeamOut(IAvatar avatar, AutoReplicationMode autoReplicationMode = AutoReplicationMode.UseGlobalDefaultInOASISDNA, AutoFailOverMode autoFailOverMode = AutoFailOverMode.UseGlobalDefaultInOASISDNA, AutoLoadBalanceMode autoLoadBalanceMode = AutoLoadBalanceMode.UseGlobalDefaultInOASISDNA, bool waitForAutoReplicationResult = false, ProviderType providerType = ProviderType.Default)
370445
{
371446
OASISResult<IAvatar> result = new OASISResult<IAvatar>();

OASIS Architecture/NextGenSoftware.OASIS.API.Core/NextGenSoftware.OASIS.API.Core.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@
5858
<ItemGroup>
5959
<ProjectReference Include="..\NextGenSoftware.OASIS.API.DNA\NextGenSoftware.OASIS.API.DNA.csproj" />
6060
<ProjectReference Include="..\NextGenSoftware.OASIS.Common\NextGenSoftware.OASIS.Common.csproj" />
61-
<!-- Removed Utilities reference as it may not exist or cause circular dependency -->
62-
<!-- <ProjectReference Include="..\..\..\NextGenSoftware-Libraries\NextGenSoftware Libraries\NextGenSoftware.Utilities\NextGenSoftware.Utilities.csproj" /> -->
61+
<ProjectReference Include="..\..\External Libs\NextGenSoftware-Libraries\NextGenSoftware Libraries\NextGenSoftware.Utilities\NextGenSoftware.Utilities.csproj" />
6362
</ItemGroup>
6463

6564

0 commit comments

Comments
 (0)