Skip to content
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

Add a route to show user targets #712

Merged
merged 14 commits into from
Jan 22, 2024

Conversation

stnguyen90
Copy link
Contributor

@stnguyen90 stnguyen90 commented Jan 9, 2024

What does this PR do?

Add a route to show user targets

There's some code for creating a target, but it must go through design first.

Test Plan

Manual

Related PRs and Issues

Parent:

Child:

Have you read the Contributing Guidelines on issues?

Yes

Copy link

vercel bot commented Jan 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
console-cloud ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 22, 2024 2:25pm
console-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 22, 2024 2:25pm
console-preview-cloud ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 22, 2024 2:25pm

@stnguyen90
Copy link
Contributor Author

@chenparnasa, you okay with going forward with this, for now?

There's some code for creating a target, but it must go through design
first.
We must pass undefined because the server won't accept an empty string.
Undefined will make the server use the default value, which is an empty
string.
Don't allow filtering on userName since the attribute isn't in the
collection to be filtered.

Allow filtering on type since it is available and it would be userful.

Change $createdAt type to datetime to allow filtering by greater/less
than.
Comment on lines +49 to +64
const promisesById: Record<string, Promise<any>> = {};
targets.targets.forEach((target) => {
if (target.providerId && !promisesById[target.providerId]) {
promisesById[target.providerId] = sdk.forProject.client.call(
'GET',
new URL(
`${sdk.forProject.client.config.endpoint}/messaging/providers/${target.providerId}`
),
{
'X-Appwrite-Project': sdk.forProject.client.config.project,
'content-type': 'application/json',
'X-Appwrite-Mode': 'admin'
}
);
}
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fetching providers here because Jake said:

Any way the API does this will be exceedingly heavy-handed, since there are likely to be only a few providers but many targets, can we use a memory-map and just fetch ones into it as they're missing while iterating targets?

…ibers

Update filterable subscriber columns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants