mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
refactor(nestjs): Implement users module
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
export const DATE_FORMATS = [
|
||||
'MM/DD/YY',
|
||||
'DD/MM/YY',
|
||||
'YY/MM/DD',
|
||||
'MM/DD/yyyy',
|
||||
'DD/MM/yyyy',
|
||||
'yyyy/MM/DD',
|
||||
'DD MMM YYYY',
|
||||
'DD MMMM YYYY',
|
||||
'MMMM DD, YYYY',
|
||||
];
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
import { GetDateFormatsService } from './queries/GetDateFormats.service';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@Controller('/')
|
||||
@ApiTags('misc')
|
||||
export class MiscellaneousController {
|
||||
constructor(private readonly getDateFormatsSevice: GetDateFormatsService) {}
|
||||
|
||||
@Get('/date-formats')
|
||||
getDateFormats() {
|
||||
return this.getDateFormatsSevice.getDateFormats();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { GetDateFormatsService } from './queries/GetDateFormats.service';
|
||||
import { MiscellaneousController } from './Miscellaneous.controller';
|
||||
|
||||
@Module({
|
||||
providers: [GetDateFormatsService],
|
||||
exports: [GetDateFormatsService],
|
||||
controllers: [MiscellaneousController],
|
||||
})
|
||||
export class MiscellaneousModule {}
|
||||
@@ -0,0 +1,15 @@
|
||||
import * as moment from 'moment';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { DATE_FORMATS } from '../Miscellaneous.constants';
|
||||
|
||||
@Injectable()
|
||||
export class GetDateFormatsService {
|
||||
getDateFormats() {
|
||||
return DATE_FORMATS.map((dateFormat) => {
|
||||
return {
|
||||
label: `${moment().format(dateFormat)} [${dateFormat}]`,
|
||||
key: dateFormat,
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user