Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 72601

Re: New web apps APIs (v3) - feedback needed

$
0
0

But even if you throw more hardware at the web apps, I think the structure of the web apps design doesn't lend itself to large scale. I've explored this for a project we were doing and what web apps really need is a solution that's not a relational database, like a noSQL. BC users expect web apps to work like a typical database, where you can make queries on custom fields like they would on a traditional database, but it's a hard thing to do if you don't change the DB schema.

 

I think that BC could potentially store them the way it stores them now and push them to noSQL for retrieval. When you make an edit to an item you make it in relational database and simply overwrite the info in noSQL for retrieval. Or use something like JSON field if such thing exists in DB they're using. PostgreSQL has it PostgreSQL: Documentation: 9.4: JSON Types and it's a pleasure to use. Maybe BC can add something like to by adding another TEXT field, like what they have description now and then do serialisation and deserialisation in and from JSON when writing and retrieving data. But I cant's see more hardware helping this issue.

 

Anyway, for those using Python (this is Django), here's a schema in Django ORM which uses relational DB to store web apps, web app items and custom fields and their values:

 

String = 1
String_MultiLine = 2
EMAIL = 3
Boolean = 4
CheckBox_List = 5
DropDown_List = 6
ListBox_List = 7
Radio_List = 8
Image = 9
DateTime = 10
DATE_TIME = 11
HIDDEN = 12
Number = 13
String_Hyperlink = 14
DOB = 15
DataSource = 16


# Names for all available field types.
NAMES = (
    (String, _("Single line text")),    (String_MultiLine, _("Multi line text")),    (EMAIL, _("Email")),    (Number, _("Number")),    (String_Hyperlink, _("URL")),    (Boolean, _("Check box")),    (CheckBox_List, _("Check boxes")),    (DropDown_List, _("Drop down")),    (ListBox_List, _("Multi select")),    (Radio_List, _("Radio buttons")),    (Image, _("File upload")),    (DateTime, _("Date")),    (DATE_TIME, _("Date/time")),    (DOB, _("Date of birth")),    (HIDDEN, _("Hidden")),    (DataSource, _("DataSource")),
)


# Field classes for all available field types.
CLASSES = {
    String: forms.CharField,    String_MultiLine: forms.CharField,    EMAIL: forms.EmailField,    Boolean: forms.BooleanField,    CheckBox_List: forms.MultipleChoiceField,    DropDown_List: forms.ChoiceField,    ListBox_List: forms.MultipleChoiceField,    Radio_List: forms.ChoiceField,    Image: forms.FileField,    DateTime: forms.DateField,    DATE_TIME: forms.DateTimeField,    DOB: forms.DateField,    HIDDEN: forms.CharField,    Number: forms.FloatField,    String_Hyperlink: forms.URLField,    DataSource: forms.CharField,
}


# Widgets for field types where a specialised widget is required.
WIDGETS = {
    String_MultiLine: forms.Textarea,    CheckBox_List: forms.CheckboxSelectMultiple,    Radio_List: forms.RadioSelect,    DateTime: SelectDateWidget,    DOB: SelectDateWidget,    HIDDEN: forms.HiddenInput,
}


# Some helper groupings of field types.
CHOICES = (Boolean, DropDown_List, Radio_List)
DATES = (DateTime, DATE_TIME, DOB)
MULTIPLE = (CheckBox_List, ListBox_List)


class Webapp(models.Model):
    webapp_id = models.IntegerField("ID")    name = models.CharField("Name", max_length=300)    slug = models.SlugField("Slug", unique=False, max_length=100)    create_date = models.DateTimeField("Date Created", auto_now_add=True)    site = models.ForeignKey(BCSite, related_name="webapps")


class WebappItem(models.Model):
    item_id = models.IntegerField("Item ID", null=True, blank=True)    external_id = models.CharField("External ID", max_length=150, null=True, blank=True)    name = models.CharField("Name", max_length=1000, blank=True)    slug = models.SlugField("Slug", unique=False, max_length=100, blank=True)    enabled = models.BooleanField("Enabled", default=True, blank=True)    release_date = models.DateField("Release Date", null=True, blank=True)    expiry_date = models.DateField("Expiry Date", null=True, blank=True)    weight = models.IntegerField("Weighting", null=True, blank=True)    uri = models.CharField("URI", max_length=400, null=True, blank=True)    description = models.TextField("Item Description", blank=True)    address = models.CharField("Address", max_length=200, null=True, blank=True)    city = models.CharField("City", max_length=100, null=True, blank=True)    state = models.CharField("State", max_length=50, null=True, blank=True)    zipcode = models.CharField("Zip", max_length=15, null=True, blank=True)    country = models.CharField("Country", max_length=15, null=True, blank=True)    categories = models.CharField("Categories",max_length=300, null=True, help_text="Comma separated categories", blank=True)    template_id = models.IntegerField("Template ID", default=-1, null=True, blank=True)    upload_response = models.CharField("Upload Response Code", max_length=100, null=True, blank=True)    modified = models.DateTimeField("Modified On", null=True)    create_date = models.DateTimeField("Date Created", auto_now_add=True)    last_update_date = models.DateTimeField("Last Update Date", auto_now=True, null=True, blank=True)    webapp = models.ForeignKey(Webapp, related_name="items", blank=True)


class CustomField(models.Model):
    label = models.CharField("Label", max_length=150)    field_type = models.IntegerField("Type", choices=fields.NAMES)    required = models.BooleanField("Required", default=True)    visible = models.BooleanField("Visible", default=True)    choices = models.CharField("Choices", max_length=4000, blank=True,                              help_text="Comma separated options where applicable. If an option "                                        "itself contains commas, surround the option starting with the %s "                                        "character and ending with the %s character." % ("`", "`"))    default = models.CharField("Default value", blank=True, max_length=4000)    dataSource = models.CharField("Data Source (web app name)", max_length=100, null=True, blank=True)    webapp = models.ForeignKey(Webapp, related_name="custom_fields")


class CustomFieldEntry(models.Model):
    field_id = models.ForeignKey(CustomField)    value = models.CharField(max_length=4000, null=True, blank=True)    create_date = models.DateTimeField("Date Created", auto_now_add=True)    webapp_item = models.ForeignKey(WebappItem, related_name="entires")

Viewing all articles
Browse latest Browse all 72601

Trending Articles