© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago
MaxTechnics

Proper way to createUrls from multiple rows

I have a table with different kinds of carousel item (image, text, text2)
Under the
data
data
column, the image typed data has a
path
path
key where the image is stored in Storage

I have the follownig code:
const { data: items, error: items_error } = await db.from('carousel_items').select('id, type, author, duration, visible, data').in('id', data.items);
const { data: items, error: items_error } = await db.from('carousel_items').select('id, type, author, duration, visible, data').in('id', data.items);


I know that i can do the following to filter the image items and createUrls(), however i'm not sure how it can properly be appended to the data key back at the
items
items
level

const imageItems = items.filter(item => item.type === 'image');

type DBImageData = {
    title: string;
    path: string;
};

const imageItemUrls = imageItems.map(item => (item.data as DBImageData).path);
const imageItems = items.filter(item => item.type === 'image');

type DBImageData = {
    title: string;
    path: string;
};

const imageItemUrls = imageItems.map(item => (item.data as DBImageData).path);


I want the data to be returned as
{
  title: 'title',
  url: 'createdUrl'
}
{
  title: 'title',
  url: 'createdUrl'
}


If someone could help with a 'workflow' that would be great! Thanks in advance!
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Proper Way To Call Edge From Trigger
SupabaseSSupabase / help-and-questions
14mo ago
Acceptable method to insert multiple rows
SupabaseSSupabase / help-and-questions
4y ago
Listening to multiple rows using supabase realtime subscriptions
SupabaseSSupabase / help-and-questions
4y ago
is there any way to count rows by group?
SupabaseSSupabase / help-and-questions
4y ago