[go: up one dir, main page]

0% found this document useful (0 votes)
8 views4 pages

Solution ABC

The document outlines the backend structure for task management, detailing functions for detecting a company from a URL, adding tasks, listing tasks, and updating task statuses. It also describes a frontend flow for loading company data, teams, and tasks, as well as handling offline task submissions. Additionally, it presents teamwork scenarios addressing code quality, conflict resolution, and debugging tasks from other companies.

Uploaded by

moisepr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

Solution ABC

The document outlines the backend structure for task management, detailing functions for detecting a company from a URL, adding tasks, listing tasks, and updating task statuses. It also describes a frontend flow for loading company data, teams, and tasks, as well as handling offline task submissions. Additionally, it presents teamwork scenarios addressing code quality, conflict resolution, and debugging tasks from other companies.

Uploaded by

moisepr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

PART 1A: Backend Structure (Pseudocode + Flowchart)

Detecting Company from URL

function getCompanyIdFromRequest(request):

url = request.url

subdomain = extractSubdomain(url) // ex: companyA

company = findCompanyBySubdomain(subdomain)

return company.id

Add Task

function addTask(request):

companyId = getCompanyIdFromRequest(request)

input = request.body // title, teamId

task = {

id: generateUUID(),

title: input.title,

teamId: input.teamId,

companyId: companyId,

status: "Open"

saveTaskToDatabase(task)

return task

List Tasks

function listTasks(request, teamId = null):

companyId = getCompanyIdFromRequest(request)

if teamId != null:
return getTasksWhere(companyId = companyId AND teamId = teamId)

else:

return getTasksWhere(companyId = companyId)

Update Task Status

function updateTaskStatus(request):

companyId = getCompanyIdFromRequest(request)

input = request.body // taskId, newStatus

task = findTaskById(input.taskId)

if task.companyId != companyId:

return error("Unauthorized access")

task.status = input.newStatus

saveTaskToDatabase(task)

return task

PART 1B: Frontend Flow

onPageLoad():

subdomain = getSubdomain()

companyData = fetch(`/api/company/${subdomain}`)

teams = fetch(`/api/${subdomain}/teams`)

tasks = fetch(`/api/${subdomain}/tasks`)

showTeams(teams)

showTasks(tasks)

onAddTask(title, teamId):

post(`/api/${subdomain}/tasks`, { title, teamId })


onUpdateTask(taskId, newStatus):

put(`/api/${subdomain}/tasks/${taskId}`, { newStatus })

PART 2: Offline Task Submission

function submitTask(task):

try:

sendToServer(task)

show("Task submitted")

catch NetworkError:

saveToLocalStorage("pending", task)

show("Task saved offline")

onNetworkReconnect():

for task in getFromLocalStorage("pending"):

if not serverHasTask(task.id):

sendToServer(task)

removeFromLocalStorage(task)

PART 3: Teamwork Scenarios

Teammate pushed rushed code

I would privately message the teammate and suggest a code review. I’d highlight the
maintainability risks and propose improvements, possibly offering to pair-program for better
clarity. It's important to balance delivery with long-term quality.

Conflict in backend logic ideas

I would initiate a technical discussion, ensuring each side explains their reasoning. We can
compare pros/cons and, if needed, bring in a third teammate or lead for arbitration. The
goal is to find the most scalable and clear solution together.

Debug a task from another company


I would first verify the subdomain and team ownership to ensure I’m working within the
right company context. If allowed, I’d clone or simulate their environment to safely debug
without exposing data from other companies.

You might also like