Code Monkey home page Code Monkey logo

socialize-user-profile's Introduction

User Profile

This package provides the bare minimum required for a user profile and is intended to be built upon to create a custom profile class that meets your needs. Currently the fields on the schema are userId (unique), username (unique) and createdAt, and lastUpdated.

Profile Class - Extends BaseModel

Extending the Class

You can extend the profile class by adding necessary methods to it's prototype. They will then be available on instantiated objects such as when using Meteor.profiles.findOne() and when iterating over a cursor returned from Meteor.profiles.find()

    Profile.prototype.fullName = function() {
        return this.firstName + " " + this.lastName;
    }
    var userProfile = Meteor.profiles.findOne();

    console.log(userProfile.fullName()) //=> "John Doe"

Extending the Schema

To extend the schema you can use the appendSchema method provided by the BaseModel Class. The Schema uses aldeed:simple-schmea so you should pass a compatible schema definition to appendSchema.

    Profile.appendSchema({
        "firstName":{
            type:String,
            required: true
        },
        "lastName":{
            type:String,
            required: true
        }
    })

User Extensions

This package extends the socialize:user-model packge with useful methods pertaining to the user profile.

User.prototype.profile() - Returns the profile for the user. If on the client this assumes that you have published the profile data for the user.

socialize-user-profile's People

Contributors

copleykj avatar ramyelkest avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.