Commit 147a1854 authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

query boilerplates per user

parent 7afea454
......@@ -90,6 +90,13 @@
<td mat-cell *matCellDef="let element"> {{element.has_suffix}} </td>
</ng-container>
<!-- Action Column -->
<ng-container matColumnDef="action">
<th mat-header-cell *matHeaderCellDef> Action </th>
<td mat-cell *matCellDef="let element" class="action-link">
<a class="badge badge-warning" routerLink="/boilerplates/{{ element.id }}">Edit</a>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
......
......@@ -3,15 +3,6 @@ import { Boilerplate } from 'src/app/models/boilerplate.model';
import { BoilerplateService } from 'src/app/services/boilerplate.service';
export interface PeriodicElement {
id: number;
title: string;
has_prefix: boolean;
has_main: boolean;
has_suffix: boolean;
}
const ELEMENT_DATA: Boilerplate[] = [{}];
@Component({
selector: 'app-boilerplate-list',
templateUrl: './boilerplate-list.component.html',
......@@ -24,7 +15,7 @@ export class BoilerplateListComponent implements OnInit {
currentBoilerplate?: Boilerplate;
currentIndex = -1;
title = '';
displayedColumns: string[] = ['id', 'title', 'has_prefix', 'has_main', 'has_suffix'];
displayedColumns: string[] = ['id', 'title', 'has_prefix', 'has_main', 'has_suffix', 'action'];
dataSource :Boilerplate[] = [{}];
constructor(private boilerplateService: BoilerplateService) { }
......@@ -34,13 +25,11 @@ export class BoilerplateListComponent implements OnInit {
}
retrieveBoilerplates(): void {
// this.dataSource = this.boilerplates
this.boilerplateService.getAll()
.subscribe(
data => {
this.boilerplates = data;
this.dataSource = data;
console.log(this.dataSource);
},
error => {
console.log(error);
......@@ -66,6 +55,7 @@ export class BoilerplateListComponent implements OnInit {
.subscribe(
data => {
this.boilerplates = data;
this.dataSource = data;
console.log(data);
},
error => {
......
......@@ -39,7 +39,7 @@ export class AuthService {
{ email, password }
).pipe(
tap(response => this.setSession(response)),
tap(response => console.log(response)),
//tap(response => console.log(response)),
shareReplay(),
);
......
......@@ -18,7 +18,12 @@ class BoilerplateListCreateAPIView(ListCreateAPIView):
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = BoilerplateSerializer
queryset = Boilerplate.objects.all()
#queryset =
def get_queryset(self):
#print(title)
queryset_boil = Boilerplate.objects.filter(owner = self.request.user)
return queryset_boil
#Custom actions when POST
def perform_create(self, serializer):
......
......@@ -162,4 +162,3 @@ CORS_ORIGIN_WHITELIST = [
CORS_ORIGIN_REGEX_WHITELIST = [
'http://155.207.131.19:8081',
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment