diff --git a/libs/core/src/framework/types.ts b/libs/core/src/framework/types.ts
index 44aad242f97..fbefb7606a2 100644
--- a/libs/core/src/framework/types.ts
+++ b/libs/core/src/framework/types.ts
@@ -118,7 +118,7 @@ export type CommandInput = ZodObject<{
*/
export type CommandContext = {
readonly actor: Actor;
- readonly payload: z.input;
+ readonly payload: z.infer;
};
/**
@@ -130,7 +130,7 @@ export type CommandContext = {
*/
export type QueryContext = {
readonly actor: Actor;
- readonly payload: z.input;
+ readonly payload: z.infer;
};
/**
diff --git a/libs/model/src/community/GetMembers.query.ts b/libs/model/src/community/GetMembers.query.ts
index 30f6c183d5a..e926a768da2 100644
--- a/libs/model/src/community/GetMembers.query.ts
+++ b/libs/model/src/community/GetMembers.query.ts
@@ -108,7 +108,7 @@ export function GetMembers(): Query {
order_direction,
} = payload;
- const offset = limit! * (cursor! - 1);
+ const offset = limit * (cursor - 1);
const addresses = allowedAddresses?.split(',').map((a) => a.trim()) ?? [];
const replacements = {
@@ -129,8 +129,8 @@ export function GetMembers(): Query {
const sql =
search || memberships || addresses.length > 0
- ? membersSqlWithSearch(cte, orderBy, limit!, offset)
- : membersSqlWithoutSearch(orderBy, limit!, offset);
+ ? membersSqlWithSearch(cte, orderBy, limit, offset)
+ : membersSqlWithoutSearch(orderBy, limit, offset);
const members = await models.sequelize.query<
z.infer & { total?: number }
diff --git a/libs/model/src/community/SetCommunityStake.command.ts b/libs/model/src/community/SetCommunityStake.command.ts
index cc4a2c32979..cf2ac2ff977 100644
--- a/libs/model/src/community/SetCommunityStake.command.ts
+++ b/libs/model/src/community/SetCommunityStake.command.ts
@@ -47,10 +47,7 @@ export function SetCommunityStake(): Command {
// !side effects
const [updated] = await models.CommunityStake.upsert({
- stake_id: rest.stake_id,
- stake_token: rest.stake_token!,
- vote_weight: rest.vote_weight!,
- stake_enabled: rest.stake_enabled!,
+ ...rest,
community_id: id.toString(),
});
diff --git a/libs/model/src/contest/CreateContestManagerMetadata.command.ts b/libs/model/src/contest/CreateContestManagerMetadata.command.ts
index 2a604117b3e..29bd0ba27fa 100644
--- a/libs/model/src/contest/CreateContestManagerMetadata.command.ts
+++ b/libs/model/src/contest/CreateContestManagerMetadata.command.ts
@@ -49,8 +49,6 @@ export function CreateContestManagerMetadata(): Command<
const manager = await models.ContestManager.create(
{
...rest,
- ticker: rest.ticker!,
- decimals: rest.decimals!,
community_id: id.toString(),
created_at: new Date(),
cancelled: false,
diff --git a/libs/model/test/community/group-lifecycle.spec.ts b/libs/model/test/community/group-lifecycle.spec.ts
index aa2f07050e1..5d8609fa847 100644
--- a/libs/model/test/community/group-lifecycle.spec.ts
+++ b/libs/model/test/community/group-lifecycle.spec.ts
@@ -60,7 +60,7 @@ describe('Group lifecycle', () => {
test('should fail to query community via has_groups when none exists', async () => {
const communityResults = await query(GetCommunities(), {
actor,
- payload: { has_groups: true },
+ payload: { has_groups: true } as any,
});
expect(communityResults?.results).to.have.length(0);
});
@@ -71,7 +71,7 @@ describe('Group lifecycle', () => {
const communityResults = await query(GetCommunities(), {
actor,
- payload: { has_groups: true },
+ payload: { has_groups: true } as any,
});
expect(communityResults?.results?.at(0)?.id).to.equal(payload.id);
});
diff --git a/libs/model/test/community/stake-lifecycle.spec.ts b/libs/model/test/community/stake-lifecycle.spec.ts
index c3c71c06de4..45dc2ae4f62 100644
--- a/libs/model/test/community/stake-lifecycle.spec.ts
+++ b/libs/model/test/community/stake-lifecycle.spec.ts
@@ -102,7 +102,7 @@ describe('Stake lifecycle', () => {
test('should query community that has stake enabled', async () => {
const results = await query(GetCommunities(), {
actor,
- payload: { stake_enabled: true },
+ payload: { stake_enabled: true } as any,
});
expect(results?.totalResults).to.eq('1');
expect(results?.results?.at(0)?.id).to.eq(id_with_stake);
@@ -141,7 +141,7 @@ describe('Stake lifecycle', () => {
const commr = await query(GetCommunities(), {
actor,
- payload: { stake_enabled: true },
+ payload: { stake_enabled: true } as any,
});
expect(commr?.totalResults).to.eq('2');
});
diff --git a/libs/model/test/community/tags.spec.ts b/libs/model/test/community/tags.spec.ts
index a82101079f8..4fb800cd1bf 100644
--- a/libs/model/test/community/tags.spec.ts
+++ b/libs/model/test/community/tags.spec.ts
@@ -48,7 +48,7 @@ describe('Tags', () => {
test('should query all communities when no tag passed', async () => {
const communityResults = await query(GetCommunities(), {
actor,
- payload: {},
+ payload: {} as any,
});
expect(communityResults?.results).to.have.length(3);
});
@@ -56,7 +56,7 @@ describe('Tags', () => {
test('should query both tagged communities with tag 1 provided', async () => {
const communityResults = await query(GetCommunities(), {
actor,
- payload: { tag_ids: [tag1Id].join(',') },
+ payload: { tag_ids: [tag1Id].join(',') } as any,
});
expect(communityResults?.results).to.have.length(2);
});
@@ -64,7 +64,7 @@ describe('Tags', () => {
test('should query single community with tag 1 and 2 provided', async () => {
const communityResults = await query(GetCommunities(), {
actor,
- payload: { tag_ids: [tag1Id, tag2Id].join(',') },
+ payload: { tag_ids: [tag1Id, tag2Id].join(',') } as any,
});
expect(communityResults?.results).to.have.length(1);
});
@@ -73,7 +73,7 @@ describe('Tags', () => {
try {
await query(GetCommunities(), {
actor,
- payload: { tag_ids: 'abkjdgkjsagj,daskgjdsakgjsdg' },
+ payload: { tag_ids: 'abkjdgkjsagj,daskgjdsakgjsdg' } as any,
});
} catch (e) {
expect((e as Error).message).to.include('Invalid query payload');