Skip to content

Commit

Permalink
Minlopro: Storage Helper & Lightning Knowledge (P1) (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomeandrey authored Dec 13, 2024
2 parents 156bfd0 + 214f387 commit 1c27923
Show file tree
Hide file tree
Showing 44 changed files with 2,220 additions and 44 deletions.
3 changes: 3 additions & 0 deletions .forceignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
**/profilePasswordPolicies
**/profileSessionSettings

# Intentionally excluded metadata (i.e. problematic or managed package metadata)
**/unpackaged

# Minlopro
**/minlopro/**/profiles/Admin.profile-meta.xml
**/minlopro/**/profiles/Minlopro Force%2Ecom Site Profile.profile-meta.xml
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
- [Release Branch Preparation](#release-branch-preparation)
- [Managing Environment Variables](#managing-environment-variables)
- [Scripts in `package.json`](#scripts-in-packagejson)
- [Useful Commands](#useful-commands)
- [Code Convention](#code-convention)
- [Useful Commands](#useful-commands)

## About

Expand Down Expand Up @@ -116,7 +115,7 @@ E.g. you can execute particular script passing in ORG alias:
npm run src:push -- -o "$SCRATCH_ORG_ALIAS"
```

## Useful Commands
### Useful Commands

_Deploy Codebase_

Expand Down
3 changes: 2 additions & 1 deletion config/project-scratch-def.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
"enableUsersAreLightningOnly": false
},
"knowledgeSettings": {
"enableKnowledge": true
"enableKnowledge": true,
"enableLightningKnowledge": true
},
"mobileSettings": {
"enableS1EncryptedStoragePref2": false
Expand Down
2 changes: 1 addition & 1 deletion scripts/automations/create_scratch_org.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ sf org create scratch \
--admin-email "$ADMIN_EMAIL" \
--set-default \
--duration-days 30 \
--wait 10
--wait 15
sf config list

# Reset Admin User password
Expand Down
10 changes: 8 additions & 2 deletions scripts/deploy/post/apex/1_set_up_qa_user.apex
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ if (foundProfiles.isEmpty()) {
User qaUser = foundUsers[0];
Profile minloproProfile = foundProfiles.get(0);

// Switch to custom profile;
update new User(Id = qaUser.Id, ProfileId = minloproProfile.Id);
// Switch to custom profile + update QA user details;
UserRole qaUserRole = [SELECT Id FROM UserRole WHERE DeveloperName = 'DX_User' LIMIT 1][0];
update new User(
Id = qaUser.Id,
UserRoleId = qaUserRole.Id,
ProfileId = minloproProfile.Id,
UserPermissionsKnowledgeUser = true
);

// Assign PSG intended for internal users;
PermissionSetService service = PermissionSetService.getInstance();
Expand Down
4 changes: 2 additions & 2 deletions scripts/deploy/post/apex/2_set_up_org_admin.apex
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ update new User(
LastName = 'Admin',
UserPreferencesUserDebugModePref = true,
Country = 'United States',
UserPermissionsKnowledgeUser = true,
ExternalId__c = UserInfo.getUserName(),
UserPreferencesHasSentWarningEmail = true
UserPreferencesHasSentWarningEmail = true,
UserPermissionsKnowledgeUser = true
);
User runningUser = [
SELECT
Expand Down
4 changes: 2 additions & 2 deletions scripts/deploy/post/custom/display_records_count.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ echo "🔵 Displaying Records Count from [$TARGET_ORG_ALIAS] organization..."

# Display record counts;
sf org list sobject record-counts \
--target-org "$TARGET_ORG_ALIAS" \
--sobject Account \
--sobject Contact \
--sobject Lead \
--sobject Opportunity \
--sobject CurrencyType \
--sobject EmailTemplate \
--sobject Task \
--sobject LogEntry__c \
--target-org "$TARGET_ORG_ALIAS"
--sobject LogEntry__c
4 changes: 3 additions & 1 deletion scripts/deploy/pre/custom/resolve_env_variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ add_or_update_env_var() {
# Variable not found; add it
echo "$var_name=$var_value" >> "$ENV_FILEPATH"
fi
echo "- [$var_name] variable was set to [$var_value]."
BlueColor='\033[38;2;158;169;241m'
NoColor='\033[0m'
echo -e "- ${BlueColor}$var_name${NoColor} variable was set to ${BlueColor}$var_value${NoColor}"
}

# Calculate & set static variables
Expand Down
1 change: 1 addition & 0 deletions sfdx-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{ "path": "src/minlopro-digex" },
{ "path": "src/minlopro-digex-messaging" },
{ "path": "src/minlopro-dlrs" },
{ "path": "src/minlopro-storage-helper" },
{ "path": "src/minlopro-crma" }
],
"name": "minlopro-dx",
Expand Down
2 changes: 1 addition & 1 deletion src/minlopro-core/main/classes/logger/core/Logger.cls
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public without sharing class Logger {
log = logData.castToEvent();
EventBus.publish(log);
}
// Output to system debug anyway;
// Output to system debug anyway (use `JSON.serializePretty()` to log ALL message content in multiline fashion);
System.debug(level, '⚪ LOG => ' + message + '\n');
}

Expand Down
16 changes: 8 additions & 8 deletions src/minlopro-core/main/classes/util/Lists.cls
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ public inherited sharing class Lists {
return !isEmpty(values);
}

public static Boolean isEmpty(List<SObject> values) {
if (values == null) {
return true;
}
return values.isEmpty();
}
// Randomizer;

public static Boolean isNotEmpty(List<SObject> values) {
return !isEmpty(values);
public static Object getRandomItem(List<Object> values) {
if (isEmpty(values)) {
return null;
}
// Generate a random index between 0 and items.size() - 1
Integer randomIndex = Math.floor(Math.random() * values.size()).intValue();
return values[randomIndex];
}

// Working with 'String's;
Expand Down
18 changes: 16 additions & 2 deletions src/minlopro-core/main/classes/util/Sets.cls
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,28 @@ public inherited sharing class Sets {
return !isEmpty(recordIds);
}

public static Boolean isEmpty(Set<String> values) {
public static Boolean isEmpty(Set<String> stringValues) {
return stringValues == null || stringValues.isEmpty();
}

public static Boolean isNotEmpty(Set<String> stringValues) {
return !isEmpty(stringValues);
}

public static Boolean isEmpty(Set<Object> values) {
return values == null || values.isEmpty();
}

public static Boolean isNotEmpty(Set<String> values) {
public static Boolean isNotEmpty(Set<Object> values) {
return !isEmpty(values);
}

// Randomizer;

public static Object getRandomItem(Set<Object> values) {
return Lists.getRandomItem(new List<Object>(values));
}

// Working with 'Id's;

public static Set<Id> of(Id recordId) {
Expand Down
Loading

0 comments on commit 1c27923

Please sign in to comment.