Skip to content

Commit

Permalink
Revert "Sheets endpoint"
Browse files Browse the repository at this point in the history
This reverts commit 44d9b1f.
  • Loading branch information
SanderGi committed Jan 13, 2024
1 parent 9a102bd commit b6a9a70
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 85 deletions.
17 changes: 2 additions & 15 deletions public/components/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@ export class Table extends Component {
<option value="EXCUSED">EXCUSED</option>
<option value="LATE">LATE</option>
</type-select>
<button class="button" id="alter-button">Alter Checked</button><br>
<dialog id="role-success" style="z-index: 10; width: fit-content; height: fit-content; background: white; position: fixed; bottom: 0; top: 0; left: 0; right: 0; margin: auto; color: var(--success); animation: fadeInAndOut 3s; font-weight: bold;">
<p>role changed</p>
</dialog>
<dialog id="success" style="z-index: 10; width: fit-content; height: fit-content; background: white; position: fixed; bottom: 0; top: 0; left: 0; right: 0; margin: auto; color: var(--success); animation: fadeInAndOut 3s; font-weight: bold;">
<p>success</p>
</dialog>
<button type="button" class="button" id="export">Export to CSV</button>
<button class="button delete" id="alter-button">Alter Checked</button>
<button type="button" class="button" id="copy-sheets-import">Copy Google Sheets Import</button>
`;
}

Expand All @@ -65,7 +64,6 @@ export class Table extends Component {
'N/A': 'lightgray',
'ABSENT(self-marked)': '#fc6060',
};
console.log(attendancearr);
for (let i = 0; i < attendancearr.length; i++) {
if (attendancearr[i].user_id) attendancearr[i].id = attendancearr[i].user_id;
if (!map.has(attendancearr[i].id)) {
Expand Down Expand Up @@ -419,20 +417,9 @@ export class Table extends Component {
}
// combine each row data with new line character
csv_data = csv_data.join('\n');
// console.log(csv_data);
this.downloadCSVFile(csv_data);
};

this.shadowRoot.getElementById('copy-sheets-import').onfocus = () => {
// onfocus instead of onclick fixes the clipboard DOM exception security issue
window.navigator.clipboard.writeText(
`=IMPORTDATA("https://verified-tomcat-generally.ngrok-free.app/sheet/${this.businessID}")`,
);
this.shadowRoot.getElementById('copy-sheets-import').classList.add('success');
document.activeElement.blur();
setTimeout(() => {
this.shadowRoot.getElementById('copy-sheets-import').classList.remove('success');
}, 5000);
};
}
}

Expand Down
4 changes: 2 additions & 2 deletions server/Business.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ router.get('/changeName', async (request, response) => {
});

router.get('/getRecordSettings', async (request, response) => {
const uid = await handleAuth(request, response);
const uid = await handleAuth(request, response, request.query.businessId, { read: true });
if (!uid) return;

const businessId = request.query.businessId;
Expand All @@ -279,7 +279,7 @@ router.get('/getRecordSettings', async (request, response) => {
});

router.get('/changeRecordSettings', async (request, response) => {
const uid = await handleAuth(request, response);
const uid = await handleAuth(request, response, request.query.businessId, { write: true });
if (!uid) return;

const businessId = request.query.businessId;
Expand Down
64 changes: 0 additions & 64 deletions server/Sheets.js

This file was deleted.

4 changes: 0 additions & 4 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ app.use('/', attendanceRouter);
const { eventRouter } = require('./Event');
app.use('/', eventRouter);

// ============================ SHEETS ============================
const { sheetsRouter } = require('./Sheets');
app.use('/', sheetsRouter);

// ============================ SERVER ============================
// listen for requests :)
module.exports.app = app;
Expand Down

0 comments on commit b6a9a70

Please sign in to comment.