Merge branch 'task5' into dev: resolved conflicts
This commit is contained in:
commit
b17523eb0c
3 changed files with 16 additions and 9 deletions
|
|
@ -7,13 +7,13 @@ type Company struct {
|
|||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
Type string `json:"type"` // "COMPANY", "CANDIDATE_WORKSPACE"
|
||||
Document *string `json:"document,omitempty"` // CNPJ, EIN, VAT
|
||||
Contact *string `json:"contact,omitempty"` // Email
|
||||
Phone *string `json:"phone,omitempty"`
|
||||
Website *string `json:"website,omitempty"`
|
||||
Address *string `json:"address,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Type string `json:"type"` // "COMPANY", "CANDIDATE_WORKSPACE"
|
||||
Status string `json:"status"` // "ACTIVE", "INACTIVE"
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
|
@ -24,7 +24,7 @@ func NewCompany(id, name string, document, contact *string) *Company {
|
|||
return &Company{
|
||||
ID: id,
|
||||
Name: name,
|
||||
Slug: name, // Basic slug, repo might refine
|
||||
Slug: name,
|
||||
Type: "COMPANY",
|
||||
Document: document,
|
||||
Contact: contact,
|
||||
|
|
|
|||
|
|
@ -25,23 +25,22 @@ func (r *CompanyRepository) Save(ctx context.Context, company *entity.Company) (
|
|||
RETURNING id
|
||||
`
|
||||
|
||||
var compType = company.Type
|
||||
if compType == "" {
|
||||
compType = "company"
|
||||
}
|
||||
|
||||
slug := company.Slug
|
||||
// Fallback slug generation if empty
|
||||
if slug == "" {
|
||||
slug = company.Name
|
||||
}
|
||||
// TODO: better slugify logic in service/entity
|
||||
|
||||
var compType = company.Type
|
||||
if compType == "" {
|
||||
compType = "company"
|
||||
}
|
||||
|
||||
var id string
|
||||
err := r.db.QueryRowContext(ctx, query,
|
||||
company.Name,
|
||||
slug,
|
||||
company.Type,
|
||||
compType,
|
||||
company.Document,
|
||||
company.Contact, // email
|
||||
company.Phone,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,11 @@ func (s *AdminService) ListCompanies(ctx context.Context, verified *bool, page,
|
|||
|
||||
// Count Total
|
||||
// Count Total
|
||||
<<<<<<< HEAD
|
||||
countQuery := `SELECT COUNT(*) FROM companies WHERE type != 'CANDIDATE_WORKSPACE'`
|
||||
=======
|
||||
countQuery := `SELECT COUNT(*) FROM companies WHERE (type = 'company' OR type = 'COMPANY' OR type IS NULL)`
|
||||
>>>>>>> task5
|
||||
var countArgs []interface{}
|
||||
if verified != nil {
|
||||
countQuery += " AND verified = $1"
|
||||
|
|
@ -41,7 +45,11 @@ func (s *AdminService) ListCompanies(ctx context.Context, verified *bool, page,
|
|||
baseQuery := `
|
||||
SELECT id, name, slug, type, document, address, region_id, city_id, phone, email, website, logo_url, description, active, verified, created_at, updated_at
|
||||
FROM companies
|
||||
<<<<<<< HEAD
|
||||
WHERE type != 'CANDIDATE_WORKSPACE'
|
||||
=======
|
||||
WHERE (type = 'company' OR type = 'COMPANY' OR type IS NULL)
|
||||
>>>>>>> task5
|
||||
`
|
||||
|
||||
var args []interface{}
|
||||
|
|
|
|||
Loading…
Reference in a new issue