Skip to content

Commit

Permalink
fix(api): 🚨 fix tsc errors
Browse files Browse the repository at this point in the history
  • Loading branch information
DerZade committed Oct 6, 2023
1 parent 9d239a0 commit 9682e74
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions api/src/models/container.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { Page } from '.';
@Table({
paranoid: true
})
export default class Container extends Model<Container> {
export default class Container extends Model {
@PrimaryKey
@AutoIncrement
@Column(DataType.INTEGER)
Expand Down Expand Up @@ -73,7 +73,7 @@ export default class Container extends Model<Container> {

page.changed('updatedAt', true);

return await page.save();
await page.save().then(() => {});
});
}
}
2 changes: 1 addition & 1 deletion api/src/models/page.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { Container } from '.';
@Table({
paranoid: true
})
export default class Page extends Model<Page> {
export default class Page extends Model {
@PrimaryKey
@Column(DataType.TEXT)
public slug: string;
Expand Down
4 changes: 2 additions & 2 deletions api/src/utils/UploadService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ export class UploadService {
}

public saveFile (buffer: Buffer, mimeType: string): string {
if (!UploadService.MINE_TYPES.has(mimeType.toLowerCase())) throw new Error(`MIME type '${mimeType}' is not allowed`);
const fileEnding = UploadService.MINE_TYPES.get(mimeType.toLowerCase());

const fileEnding: string = UploadService.MINE_TYPES.get(mimeType.toLowerCase());
if (fileEnding === undefined) throw new Error(`MIME type '${mimeType}' is not allowed`);

// generate random name
let name = UploadService.randomName();
Expand Down
2 changes: 1 addition & 1 deletion api/src/utils/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { SitemapStream, streamToPromise } from 'sitemap';
import { createGzip } from 'zlib';
import { Page } from '../models';

let cachedSitemap: Buffer | null = null;
let cachedSitemap: Buffer;

const BUILD_TIME_PATH = '/build-date.txt';
let buildTime = new Date(0);
Expand Down
2 changes: 1 addition & 1 deletion api/src/v1/routes/upload.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ uploadRouter.post('/', [
], wrapAsync(async (req, res) => {
res.setHeader('Accept', UploadService.ALLOWED_MIME_TYPES.join(', '));

const contentTypeHeader = req.get('Content-Type');
const contentTypeHeader = req.get('Content-Type') ?? '';
const mime = contentTypeHeader.toLowerCase();

if (!UploadService.ALLOWED_MIME_TYPES.includes(mime)) {
Expand Down

0 comments on commit 9682e74

Please sign in to comment.