Skip to content

Commit

Permalink
fix: include instance id on server seed data (#757)
Browse files Browse the repository at this point in the history
* fix: include instance id on server seed data

* fix: wallet address detail of unlockable content

* fix: fixed testing
  • Loading branch information
abdulhakim2902 authored Feb 1, 2023
1 parent 5624fe7 commit b12c558
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions seed-data/server.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"id": 0,
"name": "Instance",
"sourceImageFileName": "profile",
"targetImagePath": "general/servers",
Expand Down
4 changes: 4 additions & 0 deletions src/__tests__/acceptance/unlockable-content.acceptance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ describe('UnlockableContentApplication', () => {
await unlockableContentRepository.deleteAll();
});

afterEach(async () => {
await serverRepository.deleteAll();
});

after(async () => {
await deleteAllRepository(app);
});
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/helpers/given-instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,7 @@ export function givenServer(server?: Partial<Server>) {

const data = Object.assign(
{
id: 0,
name: 'Myriad Social',
serverImageURL: 'https://image.com/myriad-logo.svg',
description: 'Welcome to myriad social',
Expand Down
2 changes: 2 additions & 0 deletions src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ export class MyriadApiApplication extends BootMixin(
}

const accountId = {myriad: address};
const serverId = data.id;
const serverName =
data.name === 'Instance'
? `${data.name} ${Math.floor(Math.random() * 1000)}`
Expand All @@ -488,6 +489,7 @@ export class MyriadApiApplication extends BootMixin(
const rawServer = Object.assign(
omit(data, ['sourceImageFileName', 'targetImagePath']),
{
id: serverId,
name: serverName,
serverImageURL: serverImageURL,
accountId: {
Expand Down
8 changes: 3 additions & 5 deletions src/models/server.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ export class Server extends Entity {
@property({
type: 'string',
id: true,
generated: true,
mongodb: {
dataType: 'ObjectId',
},
generated: false,
required: true,
})
id?: string;
id: number;

@property({
type: 'string',
Expand Down
5 changes: 4 additions & 1 deletion src/services/wallet-address.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ export class WalletAddressService {
const tipsBalanceInfo = {
serverId: serverId,
referenceType: referenceType,
referenceId: referenceId,
referenceId:
referenceType === ReferenceType.UNLOCKABLECONTENT
? `${server.id}/${referenceId}`
: referenceId,
};

return tipsBalanceInfo;
Expand Down

0 comments on commit b12c558

Please sign in to comment.