I have the following data structure:
"users": {
$userid: {
"forms": {
"ID_OF_FORM 1": { "name": "Name goes here" },
"ID_OF_FORM 2": { "name": "Name goes here" }
}
}
}
I want to be able to put my "forms" in a folder system to better organize all of them for the user. Right now I call them using /users/auth.id/forms/ID. I was planning on putting objects inside the forms object but I don't think i'll be able to call them with just the form id anymore if I do that.
I can't wrap my head around how I should store these folders so that they can easily be displayed.
I need to display all the folders inside root or the active id of
a folder that a user is currently in.
I also need to be able to call a form using the id of the form
Do you think this would work? Does anyone have any better suggestions on going about doing this?
"users": {
$userid: {
"forms": {
"ID_OF_FORM 1": { "name": "Name goes here", "folder_id": "ID_OF_FOLDER" },
"ID_OF_FORM 2": { "name": "Name goes here", "folder_id": "ID_OF_FOLDER" }
},
"folders": {
"ID_OF_FOLDER 1": { "name": "name of folder" },
"ID_OF_FOLDER 2": { "name": "name of folder" },
"ID_OF_FOLDER 3": {
"name": "name of folder",
"ID_OF_FOLDER 4": { "name": "would this even work" }
}
}
}
}
Looks fine to me, although it is difficult to be certain unless one knows all use-cases (for which StackOverflow is not really the right forum).
I would change the folders a bit into:
"folders": {
"ID_OF_FOLDER 1": { "name": "name of folder" },
"ID_OF_FOLDER 2": { "name": "name of folder" },
"ID_OF_FOLDER 3": { "name": "name of folder" },
"ID_OF_FOLDER 4": { "name": "would this even work", "folder_id": "ID_OF_FOLDER 3" }
}
Otherwise you run the risk of going over the 32 level limit that Firebase imposes on the depth of the tree. The nice thing is that you can directly access any folder by its ID here.
You may consider using a single top-level node for all item types, both forms and folders (and anything else that might come along as you're building the application):
"items": {
"ID_OF_FORM 1": { "type": "form", "name": "Name goes here", "folder_id": "ID_OF_FOLDER" },
"ID_OF_FORM 2": { "type": "form", "name": "Name goes here", "folder_id": "ID_OF_FOLDER" }
"ID_OF_FOLDER 1": { "type": "folder", "name": "name of folder" },
"ID_OF_FOLDER 2": { "type": "folder", "name": "name of folder" },
"ID_OF_FOLDER 3": { "type": "folder", "name": "name of folder" },
"ID_OF_FOLDER 4": { "type": "folder", "name": "would this even work", "folder_id": "ID_OF_FOLDER 3" }
}
But I don't think this is too beneficial for your use-case at the moment. Given what you've said, the split between folders and forms seem pretty good.
Related
If my data structure looks like this:
documents.json:
{
"-NG8qzvgs46A5gojZbJO": {
"-NG8r-2q1-47MWK35aT2": {
"description": "My Description",
"title": "My Title"
},
"author": "jim",
"date": "05/11/2022"
},
"-NG8ta4xpHGZxA4JRUQZ": {
"-NG8ta9e90ChdMQclirn": {
"description": "My Description",
"title": "My Title tom"
},
"author": "tom",
"date": "04/11/2022"
},
"-NG8tjfP_TYJHZcjouY8": {
"-NG8tjiryoxnWbb4wwQQ": {
"description": "My Description ccc",
"title": "My Title jim"
},
"author": "jim",
"date": "05/11/2022"
}
}
How to get all the entries where author="jim"?
This does not work:
https://testing-11f41-default-rtdb.firebaseio.com/documents.json?orderBy="author"&equalTo="jim"
Is it possible using Firebase REST API?
Thanks in advance.
When I access the URL you give, I get this response:
{
"error" : "Index not defined, add ".indexOn": "author", for path "/documents", to the rules"
}
As this message says, you need to add an index to allow this query.
In your rules:
{
"rules": {
...
"documents": {
".indexOn": "author"
}
}
}
I have a nested local data object (locale.json). And would like to use it to generate child folders and pages.
Folder structure
src/
locale/
locale.json
locale.json
{
"currency": "USD",
"language": "en-US",
"groups": [
{
"name": "Group A",
"types": [
{
"name": "Type 1",
"members": [
{
"id": "ABCD1234567890"
},
{
"id": "EFGH0987654321"
}
]
}
]
}
]
}
I would like to generate 1 page per member in their group for each locale.
Example: /en-US/group-a/ABCD1234567890.html
dist/
en-US/
group-a/
ABCD1234567890.html
But, I haven't found a way to use 11ty pagination or collections to make it happen.
I'm new to 11ty data and would appreciate your help.
Thanks!
Created an Azure template with the Microsoft.Network.VirtualNetworkCombo type element. The new operation works fine. But two out of three existing Virtual Networks when selected show "Loading..." in each of the subnet dropdowns.
Screen snapshot
I cannot figure out why 2 of 3 existing Virtual Networks get stuck in the "Loading..." state. Does anyone know what would exhibit this behavior?
Update
It has something to do with adding IPv6 address space (10:8:2::/64). Virtual Networks/subnets without IPv6 address space display fine.
Perhaps it is something to do with the constraints minAddressPrefixSize "/29" specifications for the subnets?
I sure hope the answer isn't IPv6 is not supported...
I have tested in my environment it is working fine for me.
in createUiDefinition.json i have passed the below code in "steps": [ ]
{
"name": "NetoworkConfig",
"label": "NetworkSettings",
"subLabel": {
"preValidation": "Configure the storage settings",
"postValidation": "Done"
},
"bladeTitle": "Networking",
"elements": [
{
"name": "Configure Vnet Settings",
"type": "Microsoft.Network.VirtualNetworkCombo",
"label": {
"virtualNetwork": "Virtual network",
"subnets": "Subnets"
},
"toolTip": {
"virtualNetwork": "",
"subnets": ""
},
"defaultValue": {
"addressPrefixSize": "/16"
},
"constraints": {
"minAddressPrefixSize": "/16"
},
"options": {
"hideExisting": false
},
"subnets": {
"subnet1": {
"label": "First subnet",
"defaultValue": {
"addressPrefixSize": "/24"
},
"constraints": {
"minAddressPrefixSize": "/24",
"minAddressCount": 12,
"requireContiguousAddresses": true
}
},
"subnet2": {
"label": "Second subnet",
"defaultValue": {
"addressPrefixSize": "/26"
},
"constraints": {
"minAddressPrefixSize": "/26",
"minAddressCount": 8,
"requireContiguousAddresses": true
}
}
},
"visible": true
}
]
}
Output--
Reference : https://learn.microsoft.com/en-us/azure/azure-resource-manager/managed-applications/publish-service-catalog-app?tabs=azure-powershell
I'm just starting out with Firebase (moving across from MySQL) and, after reading many documents/watching tutorials I've tried to structure the database for my "Ebay/Gumtree style app". Are there any major issues with what I've gone with?
I've sort of tried to structure it around each screen on my app so that I'm not reading a whole load of data that isn't needed (I think this is the flat structure I should be going for?), however this had led to some duplication of data (specifically images).
Is this a good way to structure the database? I've taken a few tips from here:
Best way to structure my firebase database
{
"users": {
"user1": {
"email": "example#gmail.com",
"password": "********",
"first name": "Example",
"last name": "User",
"age": "45",
"gender": "Male",
"address": "XX1 9YY"
}
},
"upload image": {
"user1": {
"image1": { #path to image
"condition": "Like New",
"price": "£100",
"upload date": "10/10/2019",
"promoted": True,
"promoted expiry": "11/11/2019"
},
"image2": {
"condition": "New",
"price": "£250",
"upload date": "12/12/2019",
"promoted": False
},
"user2": {
"image1": {
"condition": "Used",
"price": "£50",
"upload date": "05/05/2019",
"promoted": True,
"promoted expiry": "06/06/2019"
}
},
"promoted images": { #max 50 images stored here
"user1": {
"image1": #This image is a duplicated of the image above
"condition": "Like New",
"price": "£100",
"upload date": "10/10/2019",
"promoted": True,
"promoted expiry": "11/11/2019"
},
"user2": {
"image1": { #This image is also a duplicate
"condition": "Used",
"price": "£50",
"upload date": "05/05/2019",
"promoted": True,
"promoted expiry": "06/06/2019"
}
},
"categories": {
"category1": {
"image1": { #This is the third location image1 is stored
"condition": "Used",
"price": "£50",
"upload date": "05/05/2019",
"promoted": True,
"promoted expiry": "06/06/2019"
},
"image2": {
"condition": "New",
"price": "£250",
"upload date": "12/12/2019",
"promoted": False
}
},
"reviews": {
"user1": {
"review1": {
"rating": 4,
"message": "delivered on time, thanks"
},
"review2": {
"rating": 5,
"message": "great product, delivered quickly"
},
}
"user2": {
"review1": {
"rating": 1,
"message": "terrible service, took ages to arrive and was faulty!"
},
},
},
},
}
Some questions/thoughts as to why I've done things so far:
Is it a good idea to have multiple copies of the same image as it would save going through 1000s of images. For example, if I didn't have "promoted images" but wanted to find all promoted images i'd have to search through the "upload image" section (which will have many many more images than the 50 in "promoted images"
Each "category" is a new screen that will load lots of images so I've tried to separate this section out, rather than having a master "category" that gets read everytim any of the pages load.
Thanks
Followed this doc: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/rich-media-shares to upload images to reference in a organization share in LinkedIn.
Successfully uploaded the image using Assets API. The URN is in this format - urn:li:digitalmediaAsset:XXX
Retrieving asset information using the Asset ID from the digitalmediaAsset URN shows the following status:
{
"serviceRelationships": [
{
"identifier": "urn:li:userGeneratedContent",
"relationshipType": "OWNER"
}
],
"recipes": [
{
"recipe": "urn:li:digitalmediaRecipe:feedshare-image",
"status": "AVAILABLE"
}
],
"mediaTypeFamily": "STILLIMAGE",
"created": 1579015000150,
"lastModified": 1579015039823,
"id": "XXX",
"status": "ALLOWED"
}
But when I write a share using Assets URN -
POST https://api.linkedin.com/v2/shares
{
"content": {
"contentEntities": [
{
"entity": "urn:li:digitalmediaAsset:XXX"
}
],
"description": "content description",
"title": "Test Share with Content"
},
"distribution": {
"linkedInDistributionTarget": {}
},
"subject": "Test Share Subject",
"text": {
"text": "Test Share!"
},
"owner":"urn:li:organization:YYY"
}
I get the following error:
{"message":"Invalid content entity type!","status":400}
Any idea what I am doing wrong?
Add shareMediaCategory field here like this:
POST https://api.linkedin.com/v2/shares
{
"content": {
"contentEntities": [
{
"entity": "urn:li:digitalmediaAsset:XXX"
}
],
"description": "content description",
"title": "Test Share with Content",
"shareMediaCategory": "IMAGE"
},
"distribution": {
"linkedInDistributionTarget": {}
},
"subject": "Test Share Subject",
"text": {
"text": "Test Share!"
},
"owner":"urn:li:organization:YYY"
}
See the documentation for details: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/share-api#using-images-for-shares