Esempio n. 1
0
		"as":           "candidateObj",
	}},

	{"$lookup": bson.M{
		"from":         "companies",
		"localField":   "company",
		"foreignField": "_id",
		"as":           "companyObj",
	}},

	{"$project": bson.M{
		"_id":       1,
		"title":     1,
		"date":      1,
		"status":    1,
		"owner":     utils.FirstElem("$ownerObj"),
		"vacancy":   utils.FirstElem("$vacancyObj"),
		"candidate": utils.FirstElem("$candidateObj"),
		"company":   utils.FirstElem("$companyObj"),
	}},
}

func GetInterviewC(db *mgo.Database) *mgo.Collection {
	return db.C(models.CollectionInterviews)
}

func Create(db *mgo.Database, userId string, interview *models.Interview) error {
	interview.ID = bson.NewObjectId()
	interview.Owner = bson.ObjectIdHex(userId)
	interview.Status = models.NotStarted
Esempio n. 2
0
		"from":         "users",
		"localField":   "candidate",
		"foreignField": "_id",
		"as":           "candidateObj",
	}},

	{"$lookup": bson.M{
		"from":         "interviews",
		"localField":   "interview",
		"foreignField": "_id",
		"as":           "interviewObj",
	}},

	{"$project": bson.M{
		"_id":       1,
		"vacancy":   utils.FirstElem("$vacancyObj"),
		"candidate": utils.FirstElem("$candidateObj"),
		"interview": utils.FirstElem("$interviewObj"),
		"createdAt": 1,
	}},
}

func GetSubC(db *mgo.Database) *mgo.Collection {
	return db.C(models.CollectionSubscriptions)
}

func Create(db *mgo.Database, userId string, sub *models.Subscription) error {
	createdAt := time.Now()
	hCandidateID := bson.ObjectIdHex(userId)

	sub.ID = bson.NewObjectId()
Esempio n. 3
0
var log = logging.MustGetLogger("db.company")

var pipeline = []bson.M{
	{"$lookup": bson.M{
		"from":         "users",
		"localField":   "owner",
		"foreignField": "_id",
		"as":           "ownerObj",
	}},

	{"$project": bson.M{
		"_id":               1,
		"name":              1,
		"category":          1,
		"description":       1,
		"owner":             utils.FirstElem("$ownerObj"),
		"short_description": 1,
		"imageId":           1,
		"location":          1,
		"email":             1,
		"phone":             1,
		"site":              1,
		"creationDate":      1,
		"specializations":   1,
	}},
}

func GetCompanyC(db *mgo.Database) *mgo.Collection {
	return db.C(models.CollectionCompanies)
}